Skip to content

Commit

Permalink
fix header contextMenu style error
Browse files Browse the repository at this point in the history
  • Loading branch information
LyonJack committed Jun 30, 2020
1 parent f8a1e93 commit 64b30e7
Show file tree
Hide file tree
Showing 7 changed files with 2,783 additions and 2,724 deletions.
Binary file not shown.
Binary file not shown.
73 changes: 46 additions & 27 deletions source/Components/AvalonDock.Themes.VS2013/Themes/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<avalonDockConverters:LayoutItemFromLayoutModelConverter x:Key="LayoutItemFromLayoutModelConverter" />
<avalonDockConverters:ActivateCommandLayoutItemFromLayoutModelConverter x:Key="ActivateCommandLayoutItemFromLayoutModelConverter" />

<Style x:Key="DropDownControlArea" TargetType="avalonDockControls:DropDownControlArea" />

<!--
Re-styling this in AvalonDock since the menu on the drop-down button for more documents is otherwise black
BugFix for Issue http://avalondock.codeplex.com/workitem/15743
Expand Down Expand Up @@ -70,9 +72,24 @@
</Setter>
</Style>

<Style TargetType="{x:Type MenuItem}">
<Setter Property="HeaderTemplate" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplate}" />
<Setter Property="HeaderTemplateSelector" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplateSelector}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template" Value="{StaticResource MLibMenuItem}" />
</Style>

<Style BasedOn="{StaticResource {x:Type MenuItem}}" TargetType="{x:Type avalonDockControls:MenuItemEx}">
<Setter Property="IconTemplate" Value="{Binding Path=Root.Manager.IconContentTemplate}" />
<Setter Property="IconTemplateSelector" Value="{Binding Path=Root.Manager.IconContentTemplateSelector}" />
<Setter Property="Command" Value="{Binding Path=., Converter={StaticResource ActivateCommandLayoutItemFromLayoutModelConverter}}" />
<!--
Retemplate ControlTemplate of MenuItem to get rid of blue'ish highlighting colors on menu item
https://stackoverflow.com/questions/34888636/change-background-color-of-menuitem-on-mouseover
-->
</Style>

<Style BasedOn="{StaticResource {x:Type ContextMenu}}" TargetType="{x:Type ContextMenu}">
<!--<Setter Property="FontFamily" Value="{DynamicResource fontFamily}" />-->
<!--<Setter Property="FontSize" Value="{DynamicResource fontsize}" />-->
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
<Setter Property="Background" Value="{DynamicResource {x:Static reskeys:ResourceKeys.Background}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static reskeys:ResourceKeys.NavigatorWindowForeground}}" />
Expand Down Expand Up @@ -214,23 +231,7 @@
Focusable="False"
Style="{StaticResource AvalonDockThemeVs2013ToolButtonStyle}">
<avalonDockControls:DropDownButton.DropDownContextMenu>
<avalonDockControls:ContextMenuEx ItemsSource="{Binding Model.ChildrenSorted, RelativeSource={RelativeSource TemplatedParent}}">
<avalonDockControls:ContextMenuEx.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type MenuItem}}" TargetType="{x:Type avalonDockControls:MenuItemEx}">
<Setter Property="HeaderTemplate" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplate}" />
<Setter Property="HeaderTemplateSelector" Value="{Binding Path=Root.Manager.DocumentPaneMenuItemHeaderTemplateSelector}" />
<Setter Property="IconTemplate" Value="{Binding Path=Root.Manager.IconContentTemplate}" />
<Setter Property="IconTemplateSelector" Value="{Binding Path=Root.Manager.IconContentTemplateSelector}" />
<Setter Property="Command" Value="{Binding Path=., Converter={StaticResource ActivateCommandLayoutItemFromLayoutModelConverter}}" />

<!--
Retemplate ControlTemplate of MenuItem to get rid of blue'ish highlighting colors on menu item
https://stackoverflow.com/questions/34888636/change-background-color-of-menuitem-on-mouseover
-->
<Setter Property="Template" Value="{StaticResource MLibMenuItem}" />
</Style>
</avalonDockControls:ContextMenuEx.ItemContainerStyle>
</avalonDockControls:ContextMenuEx>
<avalonDockControls:ContextMenuEx ItemsSource="{Binding Model.ChildrenSorted, RelativeSource={RelativeSource TemplatedParent}}" />
</avalonDockControls:DropDownButton.DropDownContextMenu>
<Path
x:Name="MenuDropDownButtonImage"
Expand Down Expand Up @@ -567,7 +568,10 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<avalonDockControls:DropDownControlArea DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}" DropDownContextMenuDataContext="{Binding Path=LayoutItem, RelativeSource={RelativeSource TemplatedParent}}">
<avalonDockControls:DropDownControlArea
DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
DropDownContextMenuDataContext="{Binding Path=LayoutItem, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource DropDownControlArea}">
<ContentPresenter
x:Name="Header"
Margin="2,0,0,0"
Expand Down Expand Up @@ -1354,9 +1358,12 @@
Header="{x:Static avalonDockProperties:Resources.Document_NewHorizontalTabGroup}"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem.Icon>
<Image
<Path
Width="14"
Source="../Images/HTabGroup.png"
Height="14"
VerticalAlignment="Center"
Data="{DynamicResource HTabGroup}"
Fill="{DynamicResource {x:Static reskeys:ResourceKeys.ToolWindowCaptionButtonInactiveGlyph}}"
Stretch="Uniform" />
</MenuItem.Icon>
</MenuItem>
Expand All @@ -1366,9 +1373,12 @@
Header="{x:Static avalonDockProperties:Resources.Document_NewVerticalTabGroup}"
Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem.Icon>
<Image
<Path
Width="14"
Source="../Images/VTabGroup.png"
Height="14"
VerticalAlignment="Center"
Data="{DynamicResource VTabGroup}"
Fill="{DynamicResource {x:Static reskeys:ResourceKeys.ToolWindowCaptionButtonInactiveGlyph}}"
Stretch="Uniform" />
</MenuItem.Icon>
</MenuItem>
Expand Down Expand Up @@ -1433,7 +1443,10 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<avalonDockControls:DropDownControlArea DropDownContextMenu="{Binding Root.Manager.DocumentContextMenu}" DropDownContextMenuDataContext="{Binding LayoutItem, RelativeSource={RelativeSource TemplatedParent}}">
<avalonDockControls:DropDownControlArea
DropDownContextMenu="{Binding Root.Manager.DocumentContextMenu}"
DropDownContextMenuDataContext="{Binding LayoutItem, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource DropDownControlArea}">
<Border
Margin="0,3,0,3"
Background="{TemplateBinding Background}"
Expand Down Expand Up @@ -1594,7 +1607,10 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutAnchorableTabItem}">
<avalonDockControls:DropDownControlArea DropDownContextMenu="{Binding Root.Manager.AnchorableContextMenu}" DropDownContextMenuDataContext="{Binding LayoutItem, RelativeSource={RelativeSource TemplatedParent}}">
<avalonDockControls:DropDownControlArea
DropDownContextMenu="{Binding Root.Manager.AnchorableContextMenu}"
DropDownContextMenuDataContext="{Binding LayoutItem, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource DropDownControlArea}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Expand Down Expand Up @@ -1984,7 +2000,10 @@
</Grid.ColumnDefinitions>

<Border Visibility="{Binding Path=Model.IsSinglePane, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BoolToVisibilityConverter}}">
<avalonDockControls:DropDownControlArea DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}" DropDownContextMenuDataContext="{Binding Path=SingleContentLayoutItem, RelativeSource={RelativeSource TemplatedParent}}">
<avalonDockControls:DropDownControlArea
DropDownContextMenu="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
DropDownContextMenuDataContext="{Binding Path=SingleContentLayoutItem, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource DropDownControlArea}">
<ContentPresenter
Content="{Binding Model.SinglePane.SelectedContent, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding Model.Root.Manager.AnchorableTitleTemplate, RelativeSource={RelativeSource TemplatedParent}}"
Expand Down
Loading

0 comments on commit 64b30e7

Please sign in to comment.