mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Integrated about flyout. Changed the AttachedFlyout by a ContextFlyout
This commit is contained in:
parent
53c8196d88
commit
63de0d1d9f
4 changed files with 112 additions and 21 deletions
|
@ -5,7 +5,71 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="">
|
||||
|
||||
<Grid>
|
||||
<UserControl.Transitions>
|
||||
<TransitionCollection>
|
||||
<EdgeUIThemeTransition Edge="Left" />
|
||||
</TransitionCollection>
|
||||
</UserControl.Transitions>
|
||||
<Grid Width="250">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock x:Name="Header"
|
||||
Grid.Column="1"
|
||||
Margin="12,10,12,0"
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}" />
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,12,0,0"
|
||||
Orientation="Vertical">
|
||||
<TextBlock Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
FontSize="{ThemeResource BodyFontSize}"
|
||||
Margin="12,0,12,18"
|
||||
HorizontalAlignment="Left"
|
||||
MaxWidth="292"
|
||||
TextWrapping="Wrap">
|
||||
<Run x:Name="AboutFlyoutVersion" />
|
||||
<LineBreak />
|
||||
<Run x:Name="AboutControlCopyrightRun" />
|
||||
</TextBlock>
|
||||
<HyperlinkButton x:Name="AboutFlyoutEULA"
|
||||
Margin="12,0,12,6"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=529064"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=529064">
|
||||
<TextBlock x:Uid="AboutFlyoutEULA"
|
||||
Text=""
|
||||
FontSize="{ThemeResource BodyFontSize}"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton Margin="12,0,12,6"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=822631"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=822631">
|
||||
<TextBlock x:Uid="AboutControlServicesAgreement"
|
||||
Text=""
|
||||
FontSize="{ThemeResource BodyFontSize}"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
<HyperlinkButton Margin="12,0,12,6"
|
||||
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=521839"
|
||||
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=521839">
|
||||
<TextBlock x:Uid="AboutControlPrivacyStatement"
|
||||
Text=""
|
||||
FontSize="{ThemeResource BodyFontSize}"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
<Button x:Name="FeedbackButton"
|
||||
x:Uid="FeedbackButton"
|
||||
Content=""
|
||||
MinWidth="120"
|
||||
Margin="12,12,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
|
@ -22,6 +24,23 @@ namespace CalculatorApp
|
|||
public AboutFlyout()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
PopulateStrings();
|
||||
}
|
||||
|
||||
private void PopulateStrings()
|
||||
{
|
||||
var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||
Header.Text = resourceLoader.GetString("AboutButton/Content");
|
||||
var version = Package.Current.Id.Version;
|
||||
var versionNumber = $"Version {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||
AboutFlyoutVersion.Text = versionNumber;
|
||||
AboutControlCopyrightRun.Text = resourceLoader.GetString("AboutControlCopyright").Replace("%1", "2019");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -165,8 +165,9 @@
|
|||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
Glyph=""/>
|
||||
</NavigationViewItem.Icon>
|
||||
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<TextBlock Text=""
|
||||
x:Name="AboutText" />
|
||||
<NavigationViewItem.ContextFlyout>
|
||||
|
||||
<Flyout x:Name="AboutPageFlyout"
|
||||
x:Uid="AboutPageFlyout"
|
||||
|
@ -177,7 +178,7 @@
|
|||
<local:AboutFlyout x:Name="AboutPage"
|
||||
x:Load="False"/>
|
||||
</Flyout>
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
</NavigationViewItem.ContextFlyout>
|
||||
</NavigationViewItem>
|
||||
</NavigationViewList.Items>
|
||||
</NavigationViewList>
|
||||
|
|
|
@ -70,6 +70,13 @@ namespace CalculatorApp
|
|||
// DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
|
||||
// }
|
||||
//}
|
||||
|
||||
//UNO_TODO /Workaround to have both the Text localisation and the glyph working on all platforms
|
||||
var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||
if (AboutText != null)
|
||||
{
|
||||
AboutText.Text = resourceLoader.GetString("AboutButton/Content");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -502,7 +509,7 @@ namespace CalculatorApp
|
|||
this.FindName("AboutPage");
|
||||
}
|
||||
|
||||
FlyoutBase.ShowAttachedFlyout(AboutButton);
|
||||
AboutButton.ContextFlyout.ShowAt(AboutButton);
|
||||
}
|
||||
|
||||
void UnregisterEventHandlers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue