Browse Source

Update sample pages

pull/6059/head
Max Katz 5 years ago
parent
commit
8ced83c601
  1. 43
      samples/ControlCatalog/Pages/ContextFlyoutPage.xaml
  2. 2
      samples/ControlCatalog/Pages/ContextFlyoutPage.xaml.cs
  3. 2
      samples/ControlCatalog/Pages/ContextMenuPage.xaml.cs

43
samples/ControlCatalog/Pages/ContextFlyoutPage.xaml

@ -13,22 +13,22 @@
</UserControl.Styles>
<StackPanel Orientation="Vertical" Spacing="4">
<StackPanel.Styles>
<Style Selector="Border.context-target">
<Setter Property="Padding" Value="48,20" />
<Setter Property="Margin" Value="8" />
<Setter Property="Focusable" Value="True" />
<Setter Property="Background" Value="{DynamicResource SystemAccentColor}" />
</Style>
<Style Selector="Border.context-target > :is(Control)">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</StackPanel.Styles>
<TextBlock Classes="h1">Context Flyout</TextBlock>
<TextBlock Classes="h2">A right click Flyout that can be applied to any control.</TextBlock>
<UniformGrid HorizontalAlignment="Center" Rows="2">
<UniformGrid.Styles>
<Style Selector="UniformGrid > Border">
<Setter Property="Padding" Value="48,20" />
<Setter Property="Margin" Value="8" />
<Setter Property="Focusable" Value="True" />
<Setter Property="Background" Value="{DynamicResource SystemAccentColor}" />
</Style>
<Style Selector="UniformGrid > Border > :is(Control)">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UniformGrid.Styles>
<Border>
<Border Classes="context-target">
<Border.ContextFlyout>
<MenuFlyout>
<MenuItem Header="Standard _Menu Item" InputGesture="Ctrl+A" />
@ -56,7 +56,7 @@
</Border.ContextFlyout>
<TextBlock Text="Defined in XAML" />
</Border>
<Border>
<Border Classes="context-target">
<Border.Styles>
<Style Selector="MenuFlyoutPresenter MenuItem">
<Setter Property="Header" Value="{Binding Header}"/>
@ -70,13 +70,15 @@
</Border.ContextFlyout>
<TextBlock Text="Dynamically Generated"/>
</Border>
<Border x:Name="CustomContextRequestedBorder">
<Border x:Name="CustomContextRequestedBorder"
Classes="context-target">
<Border.ContextFlyout>
<Flyout Content="Should never be visible" />
</Border.ContextFlyout>
<TextBlock Text="Custom ContextRequested handler" TextWrapping="Wrap" />
</Border>
<Border x:Name="CancellableContextBorder">
<Border x:Name="CancellableContextBorder"
Classes="context-target">
<Border.ContextFlyout>
<Flyout>
<CheckBox x:Name="CancelCloseCheckBox" Content="Cancel close" />
@ -97,6 +99,7 @@
ContextMenu="{x:Null}">
<TextBox.ContextFlyout>
<Flyout FlyoutPresenterClasses="NoPadding">
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel.Styles>
<Style Selector="Button">
@ -137,6 +140,16 @@
Data="M3.52499419,3.71761187 L3.61611652,3.61611652 C4.0717282,3.16050485 4.79154862,3.13013074 5.28238813,3.52499419 L5.38388348,3.61611652 L14,12.233 L22.6161165,3.61611652 C23.1042719,3.12796116 23.8957281,3.12796116 24.3838835,3.61611652 C24.8720388,4.10427189 24.8720388,4.89572811 24.3838835,5.38388348 L15.767,14 L24.3838835,22.6161165 C24.8394952,23.0717282 24.8698693,23.7915486 24.4750058,24.2823881 L24.3838835,24.3838835 C23.9282718,24.8394952 23.2084514,24.8698693 22.7176119,24.4750058 L22.6161165,24.3838835 L14,15.767 L5.38388348,24.3838835 C4.89572811,24.8720388 4.10427189,24.8720388 3.61611652,24.3838835 C3.12796116,23.8957281 3.12796116,23.1042719 3.61611652,22.6161165 L12.233,14 L3.61611652,5.38388348 C3.16050485,4.9282718 3.13013074,4.20845138 3.52499419,3.71761187 L3.61611652,3.61611652 L3.52499419,3.71761187 Z" />
</Button>
</StackPanel>
<Border Classes="context-target"
Padding="4, 20">
<Border.ContextFlyout>
<Flyout>
<TextBlock>Hello world</TextBlock>
</Flyout>
</Border.ContextFlyout>
<TextBlock>Inner context flyout</TextBlock>
</Border>
</StackPanel>
</Flyout>
</TextBox.ContextFlyout>
</TextBox>

2
samples/ControlCatalog/Pages/ContextFlyoutPage.xaml.cs

@ -78,7 +78,7 @@ namespace ControlCatalog.Pages
var textBlock = (TextBlock)border.Child;
textBlock.Text = e.TryGetPosition(border, out var point)
? $"Context was requested with pointer at: {point}"
? $"Context was requested with pointer at: {point.X:N0}, {point.Y:N0}"
: "Context was requested without pointer";
e.Handled = true;
}

2
samples/ControlCatalog/Pages/ContextMenuPage.xaml.cs

@ -56,7 +56,7 @@ namespace ControlCatalog.Pages
var textBlock = (TextBlock)border.Child;
textBlock.Text = e.TryGetPosition(border, out var point)
? $"Context was requested with pointer at: {point}"
? $"Context was requested with pointer at: {point.X:N0}, {point.Y:N0}"
: "Context was requested without pointer";
e.Handled = true;
}

Loading…
Cancel
Save