Jump to: navigation, search

Changes


XAML Tips

2,529 bytes added, 3 September
/* TabView */
<tab name="UWP">
Adding the classification to a metaclass is enough for UWP.
</tab>
<tab name="Mobile(Maui)">
tbd!
</tab>
<tab name="Mobile(Xamarin)">
<br>
{{UnderConstructionStart}}
==== Preselection of customized Tabs ====
The approach shown above only works with the default tab set (Children, Properties, Documents). If a tab is added, removed, or reordered, this default mechanism can no longer be relied on.
<tabs>
<tab name="UWP">
Add an EvalExpression into the content area, processing the x:Name of the tab that should be checked. Bind the expression to every RadioButton's IsChecked.
<source lang="xml">
<controls:EvalExpression
x:Name="CustomTabSelector"
Visibility="Collapsed"
Expression="Title == &quot;03 Property Editing&quot; ? &quot;TestTab&quot; : (TabSelector.ToString() == &quot;ChildrenTab&quot; ? &quot;ChildrenTab&quot; : &quot;PropertiesTab&quot;)">
<controls:EvalExpressionParameter Name="Title" Value="{Binding Title}" />
<controls:EvalExpressionParameter Name="TabSelector" Value="{Binding TabSelector}" />
</controls:EvalExpression>
 
<RadioButton
x:Name="ChildrenTab"
GroupName="Tabs"
IsChecked="{Binding Path=Result, ElementName=CustomTabSelector, Converter={StaticResource EqualToTrueConverter}, ConverterParameter=ChildrenTab}" />
<RadioButton
x:Name="TestTab"
GroupName="Tabs"
IsChecked="{Binding Path=Result, ElementName=CustomTabSelector, Converter={StaticResource EqualToTrueConverter}, ConverterParameter=TestTab}" />
<RadioButton
x:Name="PropertiesTab"
GroupName="Tabs"
IsChecked="{Binding Path=Result, ElementName=CustomTabSelector, Converter={StaticResource EqualToTrueConverter}, ConverterParameter=PropertiesTab}" />
</source>
</tab>
 
<tab name="Mobile(MAUI)">
Add an EvalExpression evaluating the tab index, and bind it to the TabView SelectedIndex:
<source lang="xml">
<controls:EvalExpression
x:Key="CustomTabSelector"
Context="{Binding}"
Expression="Title == &quot;03 Property Editing&quot; ? 1 : (TabSelector.ToString() == &quot;ChildrenTab&quot; ? 0 : 2)">
<controls:EvalExpressionParameter Name="Title" Value="{Binding Title}" />
<controls:EvalExpressionParameter Name="TabSelector" Value="{Binding TabSelector}" />
</controls:EvalExpression>
 
<tabView:SfTabView SelectedIndex="{Binding Source={StaticResource CustomTabSelector}, Path=Result}">
<!-- tabView:SfTabItems in the order Children(0) / Test Tab(1) / Properties(2) ... -->
</tabView:SfTabView>
</source>
</tab>
</tabs>
{{UnderConstructionEnd}}
[[Category:Client|XAML Tips]]
[[Category:Mobile|XAML Tips]]
[[Category:WinX|XAML Tips]]
[[Category:XAML|XAML Tips]]
== FlipView ==
791
edits