I retemplated XamMenuItem but i am getting some wierd behavior. There is a XamComboEditor on the context menu and whenever I click on this control, the contextmenu closes. I set the property "StaysOpenOnClick to true on the context menu, but it wont work.
I don't know whether I am missing anything. Below is the xaml style. I could attach image to this post
<Style x:Key="PurpleMenuItemStyle" TargetType="ig:XamMenuItem"> <Setter Property="Background" Value="Transparent"/> <Setter Property="IsTabStop" Value="True"/> <Setter Property="IsEnabled" Value="True"/> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <StackPanel Orientation="Vertical"/> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ig:XamMenuItem"> <Grid Background="Gray"> <Grid Margin="5,25,5,5" Background="White"> <!-- MenuItemPresenter - presentes the content of the menu item. --> <ContentControl x:Name="MenuItemPresenter" HorizontalContentAlignment="Stretch" Visibility="Visible" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" Foreground="{TemplateBinding Foreground}" Opacity="1" Margin="5"> <Grid > <Grid.ColumnDefinitions> <ColumnDefinition x:Name="LabelColumn" Width="Auto" /> <ColumnDefinition x:Name="DropdownColumn" Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <!-- Label presenter--> <TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Text="Stream" /> <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Text="Record" /> <TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" Text="Item" /> <!-- DropDown presenter--> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="0" Name="StremContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding StreamsList}" DisplayMemberPath="ItemName" /> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="1" Name="RecordContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding RecordList}" DisplayMemberPath="ItemName" /> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="2" Name="ItemContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding ItemList}" DisplayMemberPath="ItemName" /> <Button Content="Set All" Grid.ColumnSpan="2" Grid.Row="3" HorizontalAlignment="Right" Margin="2"/> </Grid> </ContentControl> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks a bunch. It worked
Thank you for your post. I have been looking into it and I can say that the result you have is expected because when the XamComboEditor is clicked it gets the focus and this is why the ContextMenu closes, so I have created a sample project for you, with the functionality you want, where instead of ContextMenu I used Popup. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.