Skip to content

Commit

Permalink
Do not display context menu on Equipment Plan that aren't Upgrade plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Jebzou committed Nov 12, 2023
1 parent b017849 commit bcac176
Showing 1 changed file with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,32 @@
<HierarchicalDataTemplate ItemsSource="{Binding Children}">

<StackPanel>
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem
Command="{Binding AddEquipmentPlanCommand}"
Header="{Binding Translations.CreateUpgradePlan}"
Visibility="{Binding CanBePlanned, Mode=OneWay, Converter={BoolToVisibilityConverter}}"
/>
<MenuItem
Command="{Binding EditEquipmentPlanCommand}"
Header="{Binding Translations.EditUpgradePlan}"
Visibility="{Binding AlreadyPlanned, Mode=OneWay, Converter={BoolToVisibilityConverter}}"
/>
<MenuItem
Command="{Binding RemoveEquipmentPlanCommand}"
Header="{Binding Translations.RemoveUpgradePlan}"
Visibility="{Binding AlreadyPlanned, Mode=OneWay, Converter={BoolToVisibilityConverter}}"
/>
</ContextMenu>
</StackPanel.ContextMenu>

<StackPanel.Style>
<Style TargetType="StackPanel">
<Style.Triggers>
<DataTrigger Binding="{Binding CanBePlanned}" Value="True">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<MenuItem Command="{Binding AddEquipmentPlanCommand}" Header="{Binding Translations.CreateUpgradePlan}" />
</ContextMenu>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding AlreadyPlanned}" Value="True">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<MenuItem Command="{Binding EditEquipmentPlanCommand}" Header="{Binding Translations.EditUpgradePlan}" />
<MenuItem Command="{Binding RemoveEquipmentPlanCommand}" Header="{Binding Translations.RemoveUpgradePlan}" />
</ContextMenu>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>

<TextBlock Text="{Binding DisplayName}" />

Expand Down

0 comments on commit bcac176

Please sign in to comment.