Skip to content

Commit 8752a01

Browse files
authored
Merge pull request #261 from CommunityToolkit/niels9001/rtl
[Gallery] Adding right-to-left toggle
2 parents 873c0ce + 3cf829e commit 8752a01

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
99
xmlns:renderer="using:CommunityToolkit.Labs.Shared.Renderers"
10+
xmlns:wasm="http://uno.ui/wasm"
1011
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1112
Loaded="ToolkitSampleRenderer_Loaded"
1213
mc:Ignorable="d">
@@ -104,6 +105,7 @@
104105
DefaultLabelPosition="Collapsed"
105106
OverflowButtonVisibility="Collapsed">
106107

108+
<!-- wasm:Visibility="Collapsed" -->
107109
<AppBarButton x:Name="ThemeBtn"
108110
Click="ThemeBtn_OnClick"
109111
Label="Toggle theme"
@@ -113,13 +115,16 @@
113115
</AppBarButton.Icon>
114116
</AppBarButton>
115117

116-
<!-- TO DO: Implement FlowDirection -->
117-
<!--<AppBarButton Label="Toggle right-to-left"
118+
<!-- wasm:Visibility="Collapsed" -->
119+
<AppBarButton x:Name="FlowDirectionBtn"
120+
Click="FlowDirectionBtn_OnClick"
121+
Label="Toggle flow direction"
118122
ToolTipService.ToolTip="Toggle right-to-left">
123+
119124
<AppBarButton.Icon>
120125
<FontIcon Glyph="&#xE1A0;" />
121126
</AppBarButton.Icon>
122-
</AppBarButton>-->
127+
</AppBarButton>
123128
<AppBarSeparator x:Name="SeperatorLine" />
124129
<AppBarButton x:Name="CodeBtn"
125130
Click="CodeBtn_OnClick"

CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,20 @@ private void ThemeBtn_OnClick(object sender, RoutedEventArgs e)
277277
}
278278
}
279279

280+
private void FlowDirectionBtn_OnClick(object sender, RoutedEventArgs e)
281+
{
282+
#if !HAS_UNO
283+
if (PageControl.FlowDirection == FlowDirection.LeftToRight)
284+
{
285+
PageControl.FlowDirection = FlowDirection.RightToLeft;
286+
}
287+
else
288+
{
289+
PageControl.FlowDirection = FlowDirection.LeftToRight;
290+
}
291+
#endif
292+
}
293+
280294
private void CodeBtn_OnClick(object sender, RoutedEventArgs e)
281295
{
282296
SourcecodeExpander.IsExpanded = !SourcecodeExpander.IsExpanded;

0 commit comments

Comments
 (0)