Skip to content

Commit

Permalink
Added ListView with language contributions to the About page
Browse files Browse the repository at this point in the history
  • Loading branch information
Timthreetwelve committed Oct 23, 2023
1 parent 9f4f08a commit ca5309b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 15 deletions.
81 changes: 66 additions & 15 deletions GetMyIP/Views/AboutPage.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<UserControl x:Class="GetMyIP.Views.AboutPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:GetMyIP.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="clr-namespace:GetMyIP.Converters"
xmlns:helpers="clr-namespace:GetMyIP.Helpers"
xmlns:local="clr-namespace:GetMyIP"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:GetMyIP.Models"
xmlns:viewmodels="clr-namespace:GetMyIP.ViewModels"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="650"
Expand All @@ -29,7 +30,8 @@
<Grid>
<!--#region Row & Column definitions-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170" />
<ColumnDefinition Width="auto" MinWidth="130" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
Expand All @@ -45,13 +47,14 @@
<RowDefinition Height="26" />
<RowDefinition Height="26" />
<RowDefinition Height="26" />
<RowDefinition Height="26" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<!--#endregion-->

<!--#region Icon in upper right-->
<Image Grid.Row="0" Grid.RowSpan="2"
Grid.Column="2"
Grid.Column="3"
Margin="10,0"
HorizontalAlignment="Right">
<Image.Style>
Expand All @@ -70,18 +73,18 @@
<!--#region TextBlocks-->
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{x:Static helpers:AppInfo.AppProduct}" />
<TextBlock Grid.Row="0" Grid.Column="1"
<TextBlock Grid.Row="0" Grid.Column="2"
Text="{DynamicResource About_Description}"
TextTrimming="CharacterEllipsis" />

<TextBlock Grid.Row="1" Grid.Column="0"
Text="{DynamicResource About_Version}" />
<TextBlock Grid.Row="1" Grid.Column="1"
<TextBlock Grid.Row="1" Grid.Column="2"
Text="{x:Static helpers:AppInfo.AppFileVersion}" />

<TextBlock Grid.Row="2" Grid.Column="0"
Text="{DynamicResource About_CreatedBy}" />
<TextBlock Grid.Row="2" Grid.Column="1"
<TextBlock Grid.Row="2" Grid.Column="2"
ToolTip="{DynamicResource About_CreatedByToolTip}"
ToolTipService.Placement="Top">
<Hyperlink Command="{Binding GoToGitHubCommand}"
Expand All @@ -93,12 +96,12 @@

<TextBlock Grid.Row="3" Grid.Column="0"
Text="{DynamicResource About_Copyright}" />
<TextBlock Grid.Row="3" Grid.Column="1"
<TextBlock Grid.Row="3" Grid.Column="2"
Text="{x:Static helpers:AppInfo.AppCopyright}" />

<TextBlock Grid.Row="4" Grid.Column="0"
Text="{DynamicResource About_License}" />
<TextBlock Grid.Row="4" Grid.Column="1">
<TextBlock Grid.Row="4" Grid.Column="2">
<Hyperlink Command="{Binding ViewLicenseCommand}"
Foreground="{DynamicResource MaterialDesignBody}">
<TextBlock Text="{DynamicResource About_LicenseText}" />
Expand All @@ -107,12 +110,12 @@

<TextBlock Grid.Row="5" Grid.Column="0"
Text="{DynamicResource About_BuildDate}" />
<TextBlock Grid.Row="5" Grid.Column="1"
<TextBlock Grid.Row="5" Grid.Column="2"
Text="{x:Static local:BuildInfo.BuildDateUtcString}" />

<TextBlock Grid.Row="6" Grid.Column="0"
Text="{DynamicResource About_CommitID}" />
<TextBlock Grid.Row="6" Grid.Column="1"
<TextBlock Grid.Row="6" Grid.Column="2"
Text="{x:Static local:BuildInfo.CommitIDString}">
<TextBlock.ToolTip>
<ToolTip>
Expand All @@ -131,7 +134,7 @@
<materialDesign:PackIcon Width="20" Height="20"
Kind="Github" />
</Grid>
<TextBlock Grid.Row="7" Grid.Column="1">
<TextBlock Grid.Row="7" Grid.Column="2">
<Hyperlink Command="{Binding GoToGitHubCommand}"
CommandParameter="{Binding Path=Text,
ElementName=tbxGithub}"
Expand All @@ -145,7 +148,7 @@

<TextBlock Grid.Row="8" Grid.Column="0"
Text="{DynamicResource About_Documentation}" />
<TextBlock Grid.Row="8" Grid.Column="1">
<TextBlock Grid.Row="8" Grid.Column="2">
<Hyperlink Command="{Binding ViewReadMeCommand}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="{DynamicResource About_DocumentationToolTip}"
Expand All @@ -156,7 +159,7 @@

<TextBlock Grid.Row="9" Grid.Column="0"
Text="{DynamicResource About_Limitations}" />
<StackPanel Grid.Row="9" Grid.Column="1"
<StackPanel Grid.Row="9" Grid.Column="2"
Orientation="Horizontal">
<TextBlock Text="{DynamicResource About_LimitsUsage}" />

Expand All @@ -176,7 +179,7 @@
<!--#region Check for new release-->
<TextBlock Grid.Row="10" Grid.Column="0"
Text="{DynamicResource About_Update}" />
<TextBlock Grid.Row="10" Grid.Column="1">
<TextBlock Grid.Row="10" Grid.Column="2">
<Hyperlink Command="{Binding CheckReleaseCommand}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="{DynamicResource About_UpdateToolTip}"
Expand All @@ -185,6 +188,54 @@
</Hyperlink>
</TextBlock>
<!--#endregion-->

<!--#region Translations-->
<TextBlock Grid.Row="12" Grid.Column="0"
HorizontalAlignment="Left"
Text="{DynamicResource About_Translations}" />

<Border Grid.Row="12" Grid.Column="2"
Width="auto"
Margin="0,0,20,0"
BorderBrush="{DynamicResource MaterialDesignTextBoxBorder}"
BorderThickness="1">
<ListView Width="auto" MaxHeight="148"
Margin="0,-1"
materialDesign:ListViewAssist.ListViewItemPadding="10,5"
ItemsSource="{x:Static models:UILanguage.DefinedLanguages}"
PreviewMouseDown="ListView_PreviewMouseDown"
ScrollViewer.HorizontalScrollBarVisibility="auto"
ScrollViewer.VerticalScrollBarVisibility="auto">
<ListView.Resources>
<Style TargetType="GridViewColumnHeader">
<Setter Property="Template" Value="{x:Null}" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock MinWidth="80"
Text="{Binding LanguageNative}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock MinWidth="70"
Text="{Binding LanguageCode}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Contributor}" />
</GridView>
</ListView.View>
</ListView>
</Border>
<!--#endregion-->

</Grid>
</ScrollViewer>
</Grid>
Expand Down
11 changes: 11 additions & 0 deletions GetMyIP/Views/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@ private void OnNavigate(object sender, RequestNavigateEventArgs e)
}
#endregion Clicked on the GitHub link

#region Mouse down in ListView
/// <summary>
/// Handle mouse down by doing nothing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
}
#endregion Mouse down in ListView
}

0 comments on commit ca5309b

Please sign in to comment.