Hi,
I have a XamGrid which has a template column of type Combo Box. The issue is if I select any value on the cell (Combo box value) and right click on it, the context menu opens up which has cut, copy , paste and in which only paste is enabled and cut, copy are disabled. I want to disable this feature i dont want this context menu opening up when I right click on any value in any cell. I have attached the screenshot of the issue.
Thanks
Arpita
Hello Arpita,
Thank you for your post. I have been looking into it and I can suggest you add the following Style for the TextBox in your XamGrid’s Resources in order to disable the ContextMenu since it is the built one of the MS Textbox element:
<Style TargetType="{x:Type TextBox}"> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu Visibility="Collapsed"/> </Setter.Value> </Setter> </Style
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
I don't have any text box element as such in my XamGrid. I have a template column which is of type combo box. This is my xamgrid setting . The setting which u have suggested in your previous post will work in this case?
<ig:XamGrid x:Name="UpdateParameterGrid" Grid.Row="0" MinWidth="600" AutoGenerateColumns="False" Width="Auto" ItemsSource="{Binding AffectedRecipes, Mode=TwoWay}" ScrollViewer.VerticalScrollBarVisibility="Auto" HorizontalAlignment="Center" MaxWidth="1055" HorizontalContentAlignment="Center" FontFamily="Tahoma" FontSize="12" BorderBrush="DarkGray" BorderThickness="0.8" CellControlAttached="UpdateParameterGrid_CellControlAttached" CellEnteringEditMode="UpdateParameterGrid_CellEnteringEditMode" CellExitingEditMode="UpdateParameterGrid_CellExitingEditMode" > <!--CellEnteringEditMode="UpdateParameterGrid_CellEnteringEditMode" CellExitedEditMode="UpdateParameterGrid_CellExitedEditMode" CellExitingEditMode="UpdateParameterGrid_CellExitingEditMode" >--> <ig:XamGrid.CellStyle> <Style TargetType="ig:CellControl"> <Setter Property="BorderThickness" Value="0,0,1,1" /> </Style> </ig:XamGrid.CellStyle> <ig:XamGrid.GroupBySettings> <ig:GroupBySettings AllowGroupByArea="Hidden" GroupByOperation="MergeCells" /> </ig:XamGrid.GroupBySettings> <ig:XamGrid.Columns> <ig:TextColumn Key="Sel_Crit_Inst_Name" HeaderText="Instances" TextWrapping="Wrap" IsReadOnly="True" MinimumWidth="100" /> <ig:TextColumn Key="Sel_Crit_Inst_Id" Visibility="Collapsed" /> <ig:TextColumn Key="Recipe" HeaderText="Recipe" IsReadOnly="True" TextWrapping="Wrap" MinimumWidth="200" /> <ig:TextColumn Key="RecipeKey" Visibility="Collapsed" /> <ig:TextColumn Key="OldParameterValue" HeaderText="Old Value" TextWrapping="Wrap" IsReadOnly="True" MinimumWidth="200"/> <ig:TextColumn Key="OldParamVersion" Visibility="Collapsed" /> <ig:TemplateColumn EditorTemplate="{StaticResource ComboBoxTemplate}" ItemTemplate="{StaticResource ComboBoxTemplate}" HorizontalContentAlignment="Stretch" Key="NewParameterValue" IsReadOnly="False"/> <ig:TextColumn Key="NewParamVersion" Visibility="Collapsed" /> <ig:CheckBoxColumn Key="IsPCGAccesible" Visibility="Collapsed" /> </ig:XamGrid.Columns> <ig:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Hover" /> <!--<ig:EditingSettings AllowEditing="Cell" IsOnCellActiveEditingEnabled="True" IsMouseActionEditingEnabled="SingleClick" />--> </ig:XamGrid.EditingSettings> </ig:XamGrid>
You should handle the GotFocus event of the ComboBox from the ComboBoxTemplate and put the code I shared with you inside its handler.
Hope this helps you.
Thanks I am able to disable it.
I have a question why the context menu opens up in some different place (please refer the image which I have attached in the beginning of the post) when I select some value and right click. The Context menu has cut, copy , paste and in which only paste is enabled and cut, copy are disabled. Why cut and copy are disabled ?
How to solve both of the problems. Can you please help.
Could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you?
I will not be able to send the sample project. But I can give you the XamGrid structure which I am using.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.