I am using the Infragistics default style for XamContextMenu and I am having two issues I can't solve: (1) I believe it is interfering with the display of the arrow indicator that should appear at the right of context menu items when there are sub-menu items. And (2) the sub-menu item backgrounds only paint half the menu item header.
I've attached a sample that demonstrates the issue. If you run the sample and right-click the menu, the context menu displays. Three of the root menu items have child menus but do not show the arrow indicator (issue #1). When you expand a root menu item with children (e.g. Item Data), the background is only half painted (issue #2).
For (1), the style has a section for the arrow indicator,
<!-- Arrow indicator presenter--> <Grid Grid.Column="2" x:Name="ArrowPanel" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed">
<Path Fill="Black" x:Name="ArrowPanelPath" VerticalAlignment="Center" Margin="7,0,7,0" Data="M0,0 L0,8 L4,4 z"/> </Grid>
I know the element in bold above is the issue, but changing it to Visible puts an arrow for all menu items regardless of whether they have children. I tried using data triggers bound to the XamMenuItem.HasChildren property, but couldn't get it to work. Can you tell me how to get arrows when a root menu item has children?
For (2), I don't really have any ideas. Why are the sub-menu items only having half the header area painted with our imenu item style background color?
Thank you for any help.
--Pat
I believe I figured out (1) by adding a trigger as follows to the arrow indicator panel,
<Grid.Style> <Style TargetType="{x:Type Grid}"> <Setter Property="Visibility" Value="Collapsed"/> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ig:XamMenuItem}}, Path=HasChildren, Mode=TwoWay}" Value="true"> <Setter Property="Visibility" Value="Visible" /> </DataTrigger> </Style.Triggers> </Style> </Grid.Style>
Which seems to work. Please let me know if there is a more preferable method. I still can't figure out (2).
Hello Pat,
I have been looking into your issues and the approach that you have found seems to work great. I can suggest you use it in order to show the arrow indicator properly.
Regarding your second issue it seems the items are not colored completely because of the Popup declaration. Please try the following declaration in the PurpleMenuItemStyle style :
<Popup x:Name="Popup" >
<Grid Background="{StaticResource MenuItemBackgroundBrush}">
<Border x:Name="PopupBorder" Opacity="0.01"
Background="{StaticResource MenuItemBackgroundBrush}"
BorderBrush="{StaticResource MenuPopupOuterBorderBrush}"
BorderThickness="1"
CornerRadius="1">
<Grid>
<Border Background="{StaticResource MenuItemVerticalBrush}">
<ScrollViewer x:Name="ScrollViewer"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto" Grid.ColumnSpan="2">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</Grid>
</Popup>
Let me know, if you need any further assistance on this matter.