View Issue Details

IDProjectCategoryView StatusLast Update
0001479NoesisGUIC++ SDKpublic2020-07-16 12:33
Reportersfernandez Assigned Tosfernandez  
PrioritynormalSeverityfeature 
Status assignedResolutionopen 
Product Version2.2.2 
Summary0001479: Define MenuItem role resource keys and use them in default style
Description

WPF defines a set of resource keys to be used for the template definition of the different MenuItem roles:

  • <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="MenuItem">
  • <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="MenuItem">
  • <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="MenuItem">
  • <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="MenuItem">

So they can be used in MenuItem style definition and allow restyling several roles of MenuItem without having to restyle all of the control:

<Style TargetType="{x:Type MenuItem}">
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Template" Value="{DynamicResource {x:Static MenuItem.SubmenuItemTemplateKey}}"/>
<Style.Triggers>
<Trigger Property="Role" Value="TopLevelHeader">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource Menu.Static.Foreground}"/>
<Setter Property="Template" Value="{DynamicResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}"/>
<Setter Property="Padding" Value="6,0"/>
</Trigger>
<Trigger Property="Role" Value="TopLevelItem">
<Setter Property="Background" Value="{StaticResource Menu.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Menu.Static.Border}"/>
<Setter Property="Foreground" Value="{StaticResource Menu.Static.Foreground}"/>
<Setter Property="Template" Value="{x:Static MenuItem.TopLevelItemTemplateKey}}"/>
<Setter Property="Padding" Value="6,0"/>
</Trigger>
<Trigger Property="Role" Value="SubmenuHeader">
<Setter Property="Template" Value="{DynamicResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}"/>
</Trigger>
</Style.Triggers>
</Style>

PlatformAny

Relationships

related to 0001305 assignedjsantos Static members not properly supported 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-05-30 10:56 sfernandez New Issue
2019-06-04 10:34 sfernandez Assigned To => sfernandez
2019-06-04 10:34 sfernandez Status new => assigned
2019-06-04 10:34 sfernandez Target Version => 2.3.0
2020-07-16 12:33 sfernandez Relationship added related to 0001305