Remove Tab Items in runtime
MohammedDastagir opened this issue · comments
I'm using Uranium tabsview control and I have a feature to remove tab at runtime based on a condition. I tried below code
In my xaml :
<material:TabView x:Name="tabsView">
<material:TabItem Title="{StaticResource Icons.AttributeQuery}" HeaderTemplate="{StaticResource TabTemplate}">
<material:TabItem.Content>
<dataAnalysis:AttributeQueryListView x:Name="attributeQueryListView"/>
</material:TabItem.Content>
</material:TabItem>
</material:TabView>
and in my xaml.cs:
tabsView.RemoveAt(0);
tabsView.Children.RemoveAt(0)
I found only above two methods but it's not working. Is there any solution to this.
Any help is appreciated, thanks!
Normally TabView supports binding items like
<m:TabView ItemsSource="{Binding MyItems}" />
<!-- or -->
<m:TabView Items="{Binding MyTabItems}" />
When you add or remove items from collection, it automatically affects to TabView.
But still, you can remove them manually from C# code. Try the following way:
tabView.Items.Remove(tabView.Items[0]);
@enisn Thanks for your response. Your solution worked like a charm.