Skip to content

Commit 68fd805

Browse files
Fix Contextual Tab Sample Page
1 parent 3438d45 commit 68fd805

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
6+
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
67
mc:Ignorable="d">
8+
<Page.Resources>
9+
<converters:VisibilityToBoolConverter x:Key="VisBoolConverter"/>
10+
</Page.Resources>
711
<Grid>
812
<Grid.RowDefinitions>
913
<RowDefinition Height="Auto"/>
@@ -86,8 +90,10 @@
8690
<AppBarButton Icon="Add" Label="New item" />
8791
</controls:TabbedCommandBarItem.SecondaryCommands>
8892
</controls:TabbedCommandBarItem>
89-
<controls:TabbedCommandBarItem Header="Picture Format" IsContextual="True"
90-
Visibility="{Binding ElementName=ContextualToggle, Path=IsOn}">
93+
<controls:TabbedCommandBarItem x:Name="PictureFormat"
94+
Header="Picture Format"
95+
IsContextual="True"
96+
Visibility="Collapsed">
9197
<AppBarButton Label="Remove Background">
9298
<AppBarButton.Icon>
9399
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE706;" />
@@ -134,7 +140,7 @@
134140
</controls:TabbedCommandBar>
135141

136142
<Grid Grid.Row="1">
137-
<ToggleSwitch x:Name="ContextualToggle" IsOn="{Binding Visibility, ElementName=ShapeFormat, Mode=TwoWay}"
143+
<ToggleSwitch x:Name="ContextualToggle" IsOn="{Binding Visibility, ElementName=PictureFormat, Converter={StaticResource VisBoolConverter}, Mode=TwoWay}"
138144
OffContent="Contextual Tab Off" OnContent="Contextual Tab On"/>
139145
</Grid>
140146
</Grid>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/XamlOnlyPage.xaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:ani="using:Microsoft.Toolkit.Uwp.UI.Animations"
55
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors"
6+
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
89
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
@@ -17,6 +18,8 @@
1718
<!-- Put a copy of any controls/resources required for XAML Parsing within XAML Only Samples -->
1819
<!-- This page is never loaded by the app, but used to trick the compiler... -->
1920
<Page.Resources>
21+
<converters:VisibilityToBoolConverter x:Key="VisibilityBoolConverter" />
22+
<converters:BoolToVisibilityConverter x:Key="BoolVisibilityConverter" />
2023
<triggers:CompareStateTrigger x:Key="CompareStateTrigger" />
2124
<triggers:IsEqualStateTrigger x:Key="IsEqualStateTrigger" />
2225
<triggers:IsNotEqualStateTrigger x:Key="IsNotEqualStateTrigger" />
@@ -34,17 +37,17 @@
3437
<ani:OpacityAnimation />
3538
<ani:StartAnimationActivity />
3639
<ani:InvokeActionsActivity />
37-
<ani:ClipAnimation/>
38-
<ani:BlurEffectAnimation/>
39-
<ani:SaturationEffectAnimation/>
40-
<ani:AnimationScope/>
41-
<ani:ExposureEffectAnimation/>
40+
<ani:ClipAnimation />
41+
<ani:BlurEffectAnimation />
42+
<ani:SaturationEffectAnimation />
43+
<ani:AnimationScope />
44+
<ani:ExposureEffectAnimation />
4245
</ani:AnimationSet>
4346
</ani:Explicit.Animations>
4447
<media:UIElementExtensions.VisualFactory>
4548
<media:PipelineVisualFactory>
4649
<media:OpacityEffect />
47-
<media:ExposureEffect/>
50+
<media:ExposureEffect />
4851
</media:PipelineVisualFactory>
4952
</media:UIElementExtensions.VisualFactory>
5053

0 commit comments

Comments
 (0)