Open dean-toolhound opened 2 months ago
An update after playing further with this. If I click outside the button on the tab, it does change tabs. If I click directly on the button nothing happens.
I got it to work with the following.
Command="{Binding Source={RelativeSource AncestorType={x:Type material:TabItem}}, Path=Command}"
Still looking to see badges as part of TabView.
Thanks.
I have created a control than can be used in the TabItem data template that allows images, color selections and badges. I have attached it here if anyone can use it. It can probably be improved upon but it does the job for me.
Here is how it is used:
<material:TabItem.HeaderTemplate>
<DataTemplate>
<controls:TabItemWithBadge Title="{Binding Source={RelativeSource AncestorType={x:Type material:TabItem}}, Path=Title}"
Command="{Binding Source={RelativeSource AncestorType={x:Type material:TabItem}}, Path=Command}"
IsSelected="{Binding Source={RelativeSource AncestorType={x:Type material:TabItem}}, Path=IsSelected}"
ImageSource="{FontImageSource FontFamily=FASolid, Glyph={x:Static fonts:Solid.CartShopping}}"
TextColor="{StaticResource Black}"
BackgroundColor="{StaticResource Gray100}"
SelectedTextColor="{StaticResource Primary}"
SelectedBackgroundColor="{StaticResource Primary}"
IsBadgeVisible="True"
BadgeText="{Binding MyBadgeText}"
BadgeTextColor="White"
BadgeBackgroundColor="Tomato"/>
</DataTemplate>
</material:TabItem.HeaderTemplate>
Thanks for the great library.
This issue is two-fold.
I have a viewmodel on my page and when I compile the code I get an error message that Command is not in my viewmodel. I have tried referencing the TabView context and the TabItem context but neither works.
Command="{Binding Path=BindingContext.Command, Source={x:Reference Tabs}}"
I can compile but clicking the tab does nothing.
I don't believe this is an issue with the tabview but do you have any suggestions?
Thanks.