alternetsoft / AlternetUI

MIT License
22 stars 2 forks source link

TabControl UIXML not works #107

Closed neoxeo closed 6 months ago

neoxeo commented 6 months ago

@generalloki

OS : Windows 11

Version : 3c3a8e0f364e10e9854f124cb414ea4b53837e30

https://docs.alternet-ui.com/api/Alternet.UI.TabControl.html

This code doesn't works in UIXML :

<TabControl SuggestedHeight="150" Name="tabControl" Margin="8">
  <TabPage Title="Page 1"></TabPage>
  <TabPage Title="Page 2"></TabPage>
  <TabPage Title="Page 3"></TabPage>
  <TabPage Title="Page 4"></TabPage>
  <TabPage Title="Page 5"></TabPage>
</TabControl>

I have test lot of things without solution

C# code need to be modified into Documentation :

var tc = new Alternet.UI.TabControl();
tc.SuggestedSize = (250, 300);
tc.Pages.Add(new TabPage { Title = "Page 1"});
tc.Pages.Add(new TabPage { Title = "Page 2" });
tc.Pages.Add(new TabPage { Title = "Page 3" });
tc.Pages.Add(new TabPage { Title = "Page 4" });
tc.Pages.Add(new TabPage { Title = "Page 5" });
tc.Parent = mainPanel;

With this on :

 var tc = new Alternet.UI.TabControl();
 tc.SuggestedSize = (250, 300);
 tc.Add("Page 1");
 tc.Add("Page 2");
 tc.Add("Page 3");
 tc.Add("Page 4");
 tc.Add("Page 5");                    
 tc.Parent =  mainPanel;
generalloki commented 6 months ago

Thanks. I returned the old behavior. There is no need to call Add anymore if tabs are declared in uixml. We switched to own TabControl instead of native one, so some new bugs are possible.

neoxeo commented 6 months ago

@generalloki

TabControl with UIXML always not works with 85dcc4c15eec552d582f39c4890308e9890d4c64 version with this simple code :

<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="testTabPages.MainWindow"
        Title="testTabPages">
    <StackPanel Orientation="Vertical" Name="mainPanel">
        <TabControl SuggestedHeight="150" Name="tabControl" Margin="8">
            <TabPage Title="Page 1"></TabPage>
            <TabPage Title="Page 2"></TabPage>
            <TabPage Title="Page 3"></TabPage>
            <TabPage Title="Page 4"></TabPage>
            <TabPage Title="Page 5"></TabPage>
        </TabControl>
    </StackPanel>
</Window>

image

Here is a more "complex" project with UIXML if you need to test : testTabPages.zip

generalloki commented 6 months ago

It seems to be working with the latest version from Master. I beleive I fixed the problem today

neoxeo commented 6 months ago

@generalloki

No it doesn't work with the latest version available, always blank window.

Here is test project with latest version 135058b3c7b2fff4e120293e229f941d5c92f971 : testTabPages_New.zip

generalloki commented 6 months ago

There is smth with your nugets version. I beleive they have the old code. If I compile with Alternet.UI latest master directly without using nugets it works fine. Here is the pic. Just in case I updated build version in master so it could help.

image

neoxeo commented 6 months ago

@generalloki

Sorry. I will have a look and try to understand what's happening.

Thanks a lot again

neoxeo commented 6 months ago

Test again with 0.9.508 now, and all works fine. :-)

I don't understand why my previous tests are KO because I pull last version, run "Install.bat", Sample show so compile is OK, update nugate package in my project.

Excuse me again to take your time for this error.

generalloki commented 6 months ago

I will try to increase build number each time I upload to master (in any case it sounds right). This would solve such kind of problems.