UXDivers / Grial-UI-Kit-Support

This is our public repository for customers to report bugs about Grial UI Kit for Xamarin Forms
61 stars 26 forks source link

TabControl TabItems dynamically add and remove tabs #407

Open camelCaseD opened 6 years ago

camelCaseD commented 6 years ago

Is it possible to add/remove a tab from a tab control after the page for it has been rendered? As I have a situation in which some tabs are only suppose to be visible based on a boolean property in my view model. I have tried to use the IsEnabled IsVisible properties on a TabItem but apparently it does not look at those as nothing happens when they are set to false. Also a property on TabControl that let's me set a collection of TabItems would be nice to have as well. So right now I have no way to add/remove tabs after declaring them in the XAML for my view.

dirivero commented 6 years ago

Sadly that's not currently supported by the TabControl. It's a good idea though, I'll add it to the backlog for further analysis.

khadeeja-alif commented 6 years ago

@dirivero What about the ItemsSource property & Tab Template property for the TabControl? Can't it be used to bind dynamic data to tabs?

dirivero commented 6 years ago

Use the ContentTemplate property as TabTemplate defines the looks for the icon+label part not its content. Please note that to make the control react to items changes you would need to change the entire collection object (the ItemsSource) as the control does not currently react to ObservableCollection change events.