Skip to content

Commit 0f00579

Browse files
committed
Add new "File" flyout for Ribbon
1 parent cf2cbeb commit 0f00579

File tree

2 files changed

+46
-13
lines changed

2 files changed

+46
-13
lines changed

Files/Controls/RibbonArea.xaml

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -910,18 +910,42 @@
910910
</TransitionCollection>
911911
</Custom:TabView.ItemContainerTransitions>
912912
<Custom:TabViewItem Tapped="TabViewItem_Tapped" Template="{StaticResource TabViewItemFluentTemplate}" BorderThickness="0" Header="File" MinWidth="48" MinHeight="32" Width="Auto">
913-
<Custom:TabViewItem.Resources>
914-
<MenuFlyout Placement="BottomEdgeAlignedLeft" Closed="MenuFlyout_Closed" x:Key="FileClickFlyout">
915-
<MenuFlyoutItem x:Name="NewWindowButton" Click="NewWindowButton_Click" Text="Open new window" Icon="NewWindow"/>
916-
<MenuFlyoutItem x:Name="SettingsButton" Click="SettingsButton_Click" Text="Settings" Icon="Setting"/>
917-
<MenuFlyoutSeparator/>
918-
<MenuFlyoutItem x:Name="ExitButton" Click="ExitButton_Click" Text="Close Files">
919-
<MenuFlyoutItem.Icon>
920-
<FontIcon Glyph="&#xE8BB;"/>
921-
</MenuFlyoutItem.Icon>
922-
</MenuFlyoutItem>
923-
</MenuFlyout>
924-
</Custom:TabViewItem.Resources>
913+
<FlyoutBase.AttachedFlyout>
914+
<Flyout Closed="MenuFlyout_Closed">
915+
<Flyout.Content>
916+
<ListView SelectionChanged="ListView_SelectionChanged" SelectionMode="Single">
917+
<ListViewItem Padding="12,8" x:Name="NewWindowButton" IsTapEnabled="true" Tapped="NewWindowButton_Click">
918+
<StackPanel Spacing="14" Orientation="Horizontal">
919+
<FontIcon Glyph="&#xE78B;"/>
920+
<StackPanel Orientation="Vertical">
921+
<TextBlock FontSize="14" FontWeight="Medium" Text="Open new window"/>
922+
<TextBlock Text="Creates a new instance of Files"/>
923+
</StackPanel>
924+
</StackPanel>
925+
</ListViewItem>
926+
<ListViewItem Padding="12,8" x:Name="SettingsButton" IsTapEnabled="true" Tapped="SettingsButton_Click">
927+
<StackPanel Spacing="14" Orientation="Horizontal">
928+
<FontIcon Glyph="&#xE713;"/>
929+
<StackPanel Orientation="Vertical">
930+
<TextBlock FontSize="14" FontWeight="Medium" Text="Settings"/>
931+
<TextBlock Text="Make changes to app preferences"/>
932+
</StackPanel>
933+
</StackPanel>
934+
</ListViewItem>
935+
<ListViewItem Padding="12,8" x:Name="ExitButton" IsTapEnabled="true" Tapped="ExitButton_Click">
936+
<StackPanel Spacing="14" Orientation="Horizontal">
937+
<FontIcon Glyph="&#xE8BB;"/>
938+
<StackPanel Orientation="Vertical">
939+
<TextBlock FontSize="14" FontWeight="Medium" Text="Close Files"/>
940+
<TextBlock Text="Closes this window"/>
941+
</StackPanel>
942+
</StackPanel>
943+
</ListViewItem>
944+
</ListView>
945+
</Flyout.Content>
946+
947+
</Flyout>
948+
</FlyoutBase.AttachedFlyout>
925949
</Custom:TabViewItem>
926950
<Custom:TabViewItem DoubleTapped="RibbonItem_DoubleTapped" x:Name="HomeRibbonItem" Template="{StaticResource TabViewItemFluentTemplate}" IsSelected="True" BorderThickness="0" Header="Home" MinWidth="48" MinHeight="32" Width="Auto">
927951
<interactivity:Interaction.Behaviors>

Files/Controls/RibbonArea.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ private async void NewWindowButton_Click(object sender, RoutedEventArgs e)
330330

331331
private void TabViewItem_Tapped(object sender, TappedRoutedEventArgs e)
332332
{
333-
((sender as TabViewItem).Resources["FileClickFlyout"] as MenuFlyout).ShowAt((sender as TabViewItem));
333+
FlyoutBase.ShowAttachedFlyout(sender as TabViewItem);
334+
//((sender as TabViewItem).Resources["FileClickFlyout"] as FlyoutPresenter).ShowAt((sender as TabViewItem));
334335
}
335336

336337
private void MenuFlyout_Closed(object sender, object e)
@@ -355,5 +356,13 @@ private void RibbonItem_DoubleTapped(object sender, DoubleTappedRoutedEventArgs
355356
itemTapped.IsSelected = true;
356357
}
357358
}
359+
360+
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
361+
{
362+
if(e.AddedItems.Count > 0)
363+
{
364+
(sender as ListView).SelectedItem = null;
365+
}
366+
}
358367
}
359368
}

0 commit comments

Comments
 (0)