Skip to content

Commit

Permalink
(chocolateyGH-501) Fix for: Package description should use all availa…
Browse files Browse the repository at this point in the history
…ble client space
  • Loading branch information
punker76 committed Apr 19, 2019
1 parent a20f2fe commit 4711167
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 78 deletions.
111 changes: 61 additions & 50 deletions Source/ChocolateyGui/Resources/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
xmlns:commands="clr-namespace:ChocolateyGui.Commands"
xmlns:utilities="clr-namespace:ChocolateyGui.Utilities"
xmlns:app="clr-namespace:ChocolateyGui"
xmlns:lang="clr-namespace:ChocolateyGui.Properties"
xmlns:lang="clr-namespace:ChocolateyGui.Properties"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d">

<ResourceDictionary.MergedDictionaries>
Expand All @@ -20,7 +21,7 @@
<ResourceDictionary Source="ControlStyles/ToggleSwitch.xaml" />
</ResourceDictionary.MergedDictionaries>

<converters:BooleanToVisibility x:Key="BooleanToVisibility" />
<converters:BooleanToVisibility x:Key="BooleanToVisibility" />
<converters:BooleanToVisibilityInverted x:Key="BooleanToVisibilityInverted" />
<converters:BooleanToTickString x:Key="BooleanToTickString" />
<converters:StringListToString x:Key="StringListToString" />
Expand Down Expand Up @@ -133,22 +134,22 @@

<Style x:Key="SourcesSeparatorContainerStyle" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource SourcesListBoxItemContainerStyle}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="5,5" />
<Setter Property="Padding" Value="5,5" />
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Background="{TemplateBinding Background}" RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}">
<Separator Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
<Separator Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundColorBrush}" />
</Style>
Expand All @@ -166,7 +167,7 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush4}" />
</Style>


<ControlTemplate x:Key="TileOverlayTemplate" TargetType="ContentControl">
<Grid ClipToBounds="True">
<Grid Height="20" Width="200">
Expand All @@ -184,51 +185,51 @@
</Grid>
</Grid>
</ControlTemplate>


<Style x:Key="ListViewModeRadioButtonStyle" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {x:Type RadioButton}}">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush3}" />
<Setter Property="Foreground" Value="{DynamicResource GrayBrush2}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="{DynamicResource FlatButtonFontSize}" />
<Setter Property="Padding" Value="5" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border x:Name="Border"
Margin="0"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ContentPresenter x:Name="PART_ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="{DynamicResource FlatButtonFontSize}" />
<Setter Property="Padding" Value="5" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border x:Name="Border"
Margin="0"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ContentPresenter x:Name="PART_ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="{DynamicResource AccentBaseColorBrush}" />
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundColorBrush}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource GrayBrush4}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource FlatButtonPressedBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource FlatButtonPressedForegroundBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource GrayBrush2}" />
</Trigger>
</Style.Triggers>
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundColorBrush}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource GrayBrush4}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource FlatButtonPressedBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource FlatButtonPressedForegroundBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource GrayBrush2}" />
</Trigger>
</Style.Triggers>
</Style>


<Style x:Key="PackageResourceLabel" TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
<Setter Property="FontWeight" Value="Bold" />
Expand Down Expand Up @@ -259,10 +260,20 @@
<Setter Property="FontSize" Value="22" />
</Style>

<Style x:Key="SectionHeaderTextStyle" TargetType="{x:Type TextBlock}">
<Style x:Key="SectionHeaderStyle" BasedOn="{StaticResource MahApps.Metro.Styles.MetroHeader}" TargetType="{x:Type Controls:MetroHeader}">
<Setter Property="Foreground" Value="{StaticResource BodyColorBrush}" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Margin" Value="3,0,0,3" />
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="18" />
<Setter Property="Padding" Value="10 5 10 5"></Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Vertical" UseLayoutRounding="True">
<TextBlock Margin="0 10 0 5" Text="{Binding}" />
<Separator Margin="0 0 5 0"/>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="DescriptionTextStyle" TargetType="{x:Type Run}">
Expand Down
60 changes: 32 additions & 28 deletions Source/ChocolateyGui/Views/PackageView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:controls="clr-namespace:ChocolateyGui.Controls"
xmlns:lang="clr-namespace:ChocolateyGui.Properties"
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
d:DesignHeight="786" d:DesignWidth="1366"
d:DataContext="{d:DesignInstance viewModels:PackageViewModel}">
Expand Down Expand Up @@ -197,41 +198,44 @@

<Grid Margin="25,5,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="5*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="{Binding ReleaseNotes, Converter={StaticResource NullToGridLength}}" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{x:Static lang:Resources.PackageView_PackageID}" Style="{StaticResource SectionHeaderTextStyle}"
Visibility="{Binding Id, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="1" Text="{Binding Id}" ScrollViewer.CanContentScroll="True" TextWrapping="Wrap"
Style="{StaticResource PageTextBlockStyle}"
Visibility="{Binding Id, Converter={StaticResource NullToVisibility}}" />
<TextBlock Grid.Row="2" Text="{x:Static lang:Resources.PackageView_Description}" Style="{StaticResource SectionHeaderTextStyle}" />
<markdig:MarkdownViewer AutomationProperties.Name="Package Description"
Grid.Row="3"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="5 0"
Markdown="{Binding Description}" />
<StackPanel Grid.Row="4" Visibility="{Binding Dependencies, Converter={StaticResource NullToVisibility}}">
<TextBlock Text="{x:Static lang:Resources.PackageView_Dependencies}" Style="{StaticResource SectionHeaderTextStyle}" />
<mah:MetroHeader Grid.Row="0"
Style="{StaticResource SectionHeaderStyle}"
Header="{x:Static lang:Resources.PackageView_PackageID}"
Visibility="{Binding Id, Converter={StaticResource NullToVisibility}}">
<TextBlock Text="{Binding Id}"
TextWrapping="Wrap"
Style="{StaticResource PageTextBlockStyle}" />
</mah:MetroHeader>
<mah:MetroHeader Grid.Row="1"
Style="{StaticResource SectionHeaderStyle}"
Header="{x:Static lang:Resources.PackageView_Description}">
<markdig:MarkdownViewer AutomationProperties.Name="Package Description"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Markdown="{Binding Description}" />
</mah:MetroHeader>
<mah:MetroHeader Grid.Row="2"
Style="{StaticResource SectionHeaderStyle}"
Header="{x:Static lang:Resources.PackageView_Dependencies}"
Visibility="{Binding Dependencies, Converter={StaticResource NullToVisibility}}">
<TextBlock Text="{Binding Dependencies, Converter={StaticResource PackageDependenciesToString}}"
Margin="5" Style="{StaticResource PageTextBlockStyle}"
Style="{StaticResource PageTextBlockStyle}"
AutomationProperties.Name="Package Dependencies" />
</StackPanel>
<TextBlock Grid.Row="5" Text="{x:Static lang:Resources.PackageView_ReleaseNotes}" Style="{StaticResource SectionHeaderTextStyle}"
Visibility="{Binding ReleaseNotes, Converter={StaticResource NullToVisibility}}" />
<markdig:MarkdownViewer Grid.Row="6"
AutomationProperties.Name="Package Release Notes"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
Margin="5 0"
Visibility="{Binding ReleaseNotes, Converter={StaticResource NullToVisibility}}"
Markdown="{Binding ReleaseNotes}" />

</mah:MetroHeader>
<mah:MetroHeader Grid.Row="3"
Style="{StaticResource SectionHeaderStyle}"
Header="{x:Static lang:Resources.PackageView_ReleaseNotes}"
Visibility="{Binding ReleaseNotes, Converter={StaticResource NullToVisibility}}">
<markdig:MarkdownViewer AutomationProperties.Name="Package Release Notes"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Markdown="{Binding ReleaseNotes}" />
</mah:MetroHeader>
</Grid>
</DockPanel>
</UserControl>
Expand Down

0 comments on commit 4711167

Please sign in to comment.