Skip to content

Commit

Permalink
(#114) Added context menu
Browse files Browse the repository at this point in the history
Warning, the update functionality is still a little derpy.
  • Loading branch information
RichiCoder1 authored and gep13 committed Sep 16, 2014
1 parent c3d97d2 commit 6b53fbc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Chocolatey.Gui/Resources/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:xaml="clr-namespace:Markdown.Xaml"
xmlns:custom="http://metro.mahapps.com/winfx/xaml/shared"
xmlns:converters="clr-namespace:Chocolatey.Gui.Utilities.Converters"
xmlns:commands="clr-namespace:Chocolatey.Gui.Commands"
mc:Ignorable="d">


<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ControlStyles/Flyout.xaml"/>
</ResourceDictionary.MergedDictionaries>

<converters:BooleanToVisibility x:Key="BooleanToVisibility"/>

<Style x:Key="BaseTextBlockStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="./Resources/#SourceSansPro-Regular"/>
Expand Down Expand Up @@ -585,6 +591,12 @@
</Setter.Value>
</Setter>
</Style>

<ContextMenu x:Key="PackagesGridContextMenu" DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
<MenuItem Header="Install" Visibility="{Binding IsInstalled, Converter={StaticResource BooleanToVisibility}, ConverterParameter=True}" Command="{commands:DataContextCommandAdapter Install}"></MenuItem>
<MenuItem Header="Uninstall" Visibility="{Binding IsInstalled, Converter={StaticResource BooleanToVisibility}}" Command="{commands:DataContextCommandAdapter Uninstall}"></MenuItem>
<MenuItem Header="Update" Visibility="{Binding CanUpdate, Converter={StaticResource BooleanToVisibility}}" Command="{commands:DataContextCommandAdapter Update}"></MenuItem>
</ContextMenu>

<Style x:Key="PackagesGridStyle" TargetType="{x:Type DataGrid}">
<Setter Property="GridLinesVisibility" Value="None"/>
Expand Down Expand Up @@ -795,6 +807,7 @@
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
<Setter Property="MinHeight" Value="25"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="ContextMenu" Value="{StaticResource PackagesGridContextMenu}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource AccentColorBrush}"/>
Expand Down

0 comments on commit 6b53fbc

Please sign in to comment.