AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.34k stars 2.2k forks source link

TabItem IsVisible = False will never show up again after set true, 0.10.0-preview5 #4719

Closed sn4k3 closed 1 year ago

sn4k3 commented 4 years ago

<TabItem IsVisible="{Binding boolVarHere}">

This correctly hides TabItem from TabControl, but when set the variable to true it won't show up ever again

maxkatz6 commented 4 years ago

@sn4k3 It works for me with current master. Can you test it with nightly builds? There were some fixes in SelectionModel that could affect this.

sn4k3 commented 4 years ago

There's any place i can download the compiled nightly builds? Or i need to compile the master? I'm currently using nuget package on the project

maxkatz6 commented 4 years ago

https://github.com/AvaloniaUI/Avalonia/wiki/Using-nightly-build-feed

sn4k3 commented 4 years ago

Still not working, tried with: 0.10.999-cibuild0010903-beta PS: I'm using IsEnabled for now to overcome this problem, and it works, i'm saying this to discard the thinking of property not correctly set. Full source: https://github.com/sn4k3/UVtools/blob/master/UVtools.WPF/MainWindow.axaml#L330

maxkatz6 commented 4 years ago

@sn4k3 control should be notified when value was changed. For instance, it can be achieved using INotifyPropertyChanged or AvaloniaProperty. In your code you have INotifyPropertyChanged in the Window, but there is no any notifications when HaveGCode is changing. As solution, you can run OnPropertyChanged(nameof(HaveGCode)) when file is loaded/unloaded and HaveGCode changes its value.

sn4k3 commented 4 years ago

I force a data context reload on every file load:

public void ResetDataContext()
        {
            var old = DataContext;
            DataContext = new object();
            DataContext = old;
        }

As told with Enable property it work good: When file is closed it got disabled, when file is loaded it got enabled But i will try OnPropertyChanged(nameof(HaveGCode))

sn4k3 commented 4 years ago

Just tried with OnPropertyChanged(nameof(HaveGCode)). Still doesnt work with IsVisible

sn4k3 commented 4 years ago

Video: https://youtu.be/FsLMC8s3u-g

maxkatz6 commented 4 years ago

@sn4k3 can you share some file example, so I can try to reproduce it in the app?

sn4k3 commented 4 years ago

Sure, try this one (Only UVtools.Core and UVtools.WPF projects are required to run the app)

_BK-12_Ball_Screw_Bearing_Block_1_copy.zip

maxkatz6 commented 4 years ago

Thanks. I reproduced it. Weird that it worked for me after I replaced HaveGCode with simple property and updating value with OnPropertyChanged after 5 seconds delay in window ctor.

I will take a deeper look later.

sn4k3 commented 3 years ago

Any new on this? i still have this problem with rc1

kekekeks commented 3 years ago

@grokys

grokys commented 3 years ago

Pinging @Gillibald as he wrote the TabControl and may be able to fix it quicker than me.

maxkatz6 commented 2 years ago

Works now

sn4k3 commented 2 years ago

Works now

I still have the problem... Tab doesnt show up. On: 0.10.10

UVtools_2021-11-01_04-47-55

sn4k3 commented 1 year ago

No longer a problem with v11.