forked from microsoft/WPF-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#544 from harshit7962/addAboutpage
Adding About Page
- Loading branch information
Showing
6 changed files
with
251 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Sample Applications/Win11ThemeGallery/ViewModels/AboutPageViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Media.Imaging; | ||
using Win11ThemeGallery.Navigation; | ||
using Win11ThemeGallery.Views; | ||
|
||
namespace Win11ThemeGallery.ViewModels | ||
{ | ||
public partial class AboutPageViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] | ||
private string _pageTitle = "About"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
Sample Applications/Win11ThemeGallery/Views/AboutPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<Page x:Class="Win11ThemeGallery.Views.AboutPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Win11ThemeGallery.Views" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
Title="AboutPage"> | ||
<Page.Resources> | ||
<Style x:Key="LinkTextBlockStyle" TargetType="TextBlock"> | ||
<Setter Property="Margin" Value="0 4 0 4" /> | ||
</Style> | ||
<Style x:Key="DefaultHyperlinkStyle" TargetType="Hyperlink"> | ||
<Setter Property="TextDecorations" Value="None" /> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" /> | ||
<Setter Property="TextDecorations" Value="Underline" /> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
|
||
<Style x:Key="AboutCardStyle" TargetType="Border"> | ||
<Setter Property="Padding" Value="0 16 0 16" /> | ||
<Setter Property="BorderThickness" Value="0 0 0 1" /> | ||
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderHeaderBorderBrush}" /> | ||
</Style> | ||
|
||
<Style x:Key="BottomAboutCardStyle" TargetType="Border"> | ||
<Setter Property="Padding" Value="0 16 0 16" /> | ||
</Style> | ||
</Page.Resources> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
|
||
<StackPanel Grid.Row="0" VerticalAlignment="Center" Margin="0 0 0 40"> | ||
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="{Binding ViewModel.PageTitle}" /> | ||
</StackPanel> | ||
|
||
<StackPanel Margin="0,0,0,24" Grid.Row="1"> | ||
<Expander> | ||
<Expander.Header> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
Source="pack://application:,,,/Assets/win11.png" Height="20" Width="20" Margin="10,5,10,5"/> | ||
|
||
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="10"> | ||
<TextBlock Text="WPF Win11 Gallery Application" /> | ||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" FontSize="11">© 2024 Microsoft. All rights reserved.</TextBlock> | ||
</StackPanel> | ||
</Grid> | ||
</Expander.Header> | ||
<Expander.Content> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<Border Grid.Row="0" Style="{StaticResource AboutCardStyle}"> | ||
<Grid Margin="48 0 16 0"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Text="To Clone This Repository" Grid.Column="0" /> | ||
<TextBlock Text="git clone https://github.com/microsoft/WPF-Samples.git" Grid.Column="2" /> | ||
</Grid> | ||
</Border> | ||
|
||
<Border Grid.Row="1" Style="{StaticResource AboutCardStyle}"> | ||
<Grid Margin="48 0 16 0"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Text="File a bug or request a new sample" Grid.Column="0" /> | ||
<TextBlock FontFamily="Segoe Fluent Icons" Text="" Grid.Column="2" MouseDown="Open_Issues" /> | ||
</Grid> | ||
</Border> | ||
|
||
<Border Grid.Row="2" Style="{StaticResource AboutCardStyle}"> | ||
<StackPanel Orientation="Vertical" Margin="48 0 16 0"> | ||
<TextBlock Text="Dependencies and References" Margin="0 0 0 12" /> | ||
<TextBlock Style="{StaticResource LinkTextBlockStyle}"> | ||
<Hyperlink Style="{StaticResource DefaultHyperlinkStyle}" Click="Open_ToolkitInformation">CommunityToolkit.Mvvm</Hyperlink> | ||
</TextBlock> | ||
<TextBlock Style="{StaticResource LinkTextBlockStyle}"> | ||
<Hyperlink Style="{StaticResource DefaultHyperlinkStyle}" Click="Open_DIInformation">Microsoft.Extensions.DependencyInjection</Hyperlink> | ||
</TextBlock> | ||
<TextBlock Style="{StaticResource LinkTextBlockStyle}"> | ||
<Hyperlink Style="{StaticResource DefaultHyperlinkStyle}" Click="Open_HostingInformation">Microsoft.Extensions.Hosting</Hyperlink> | ||
</TextBlock> | ||
</StackPanel> | ||
</Border> | ||
|
||
<Border Grid.Row="3" Style="{StaticResource BottomAboutCardStyle}"> | ||
<StackPanel Orientation="Vertical" Margin="48 0 16 0"> | ||
<TextBlock TextWrapping="Wrap" Text="THIS CODE AND INFORMATION IS PROVIDED ‘AS IS’ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE." Margin="0 0 0 12" /> | ||
<TextBlock Style="{StaticResource LinkTextBlockStyle}"> | ||
<Hyperlink Style="{StaticResource DefaultHyperlinkStyle}" | ||
Click="Services_Click">Microsoft Services Agreement</Hyperlink> | ||
</TextBlock> | ||
<TextBlock Style="{StaticResource LinkTextBlockStyle}"> | ||
<Hyperlink Style="{StaticResource DefaultHyperlinkStyle}" | ||
Click="Privacy_Click">Microsoft Privacy Statement</Hyperlink> | ||
</TextBlock> | ||
</StackPanel> | ||
</Border> | ||
</Grid> | ||
</Expander.Content> | ||
</Expander> | ||
</StackPanel> | ||
</Grid> | ||
</Page> |
63 changes: 63 additions & 0 deletions
63
Sample Applications/Win11ThemeGallery/Views/AboutPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using Win11ThemeGallery.ViewModels; | ||
|
||
namespace Win11ThemeGallery.Views | ||
{ | ||
/// <summary> | ||
/// Interaction logic for AboutPage.xaml | ||
/// </summary> | ||
public partial class AboutPage : Page | ||
{ | ||
public AboutPageViewModel ViewModel { get; } | ||
|
||
public AboutPage(AboutPageViewModel viewModel) | ||
{ | ||
ViewModel = viewModel; | ||
DataContext = this; | ||
InitializeComponent(); | ||
} | ||
|
||
private void Services_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://go.microsoft.com/fwlink/?LinkId=822631") { UseShellExecute = true }); | ||
} | ||
|
||
private void Privacy_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://go.microsoft.com/fwlink/?LinkId=521839") { UseShellExecute = true }); | ||
} | ||
|
||
private void Open_Issues(object sender, MouseButtonEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://github.com/microsoft/WPF-Samples/issues/new") { UseShellExecute = true }); | ||
} | ||
|
||
private void Open_ToolkitInformation(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://www.nuget.org/packages/CommunityToolkit.Mvvm/") { UseShellExecute = true }); | ||
} | ||
|
||
private void Open_DIInformation(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/") { UseShellExecute = true }); | ||
} | ||
|
||
private void Open_HostingInformation(object sender, RoutedEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo("https://www.nuget.org/packages/Microsoft.Extensions.Hosting") { UseShellExecute = true }); | ||
} | ||
} | ||
} |