In order to set up dynamic conetextmenu in xamGrid, I did as below:Xaml:<ig:XamGrid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding DataList}" AutoGenerateColumns="False" CellDoubleClicked="xamGrid_CellDoubleClicked" CellClicked="xamGrid_CellClicked" RowSelectorClicked="xamGrid_RowSelectorClicked"> <ig:ContextMenuService.Manager> <ig:ContextMenuManager ModifierKeys="None"> <ig:ContextMenuManager.ContextMenu> <ig:XamContextMenu ItemClicked="XamContextMenu_ItemClicked" Opening="XamContextMenu_Opening"> <DataTemplate> <ig:XamMenuItem Header="{Binding MytName}" IsCheckable="True"> </ig:XamMenuItem> </DataTemplate> </ig:XamContextMenu> </ig:ContextMenuManager.ContextMenu> </ig:ContextMenuManager></ig:ContextMenuService.Manager>...</ig:XamGrid>COde: private void XamContextMenu_Opening(object sender, OpeningEventArgs e) { List<XamGrid> elements = e.GetClickedElements<XamGrid>(); if (elements.Count == 0) { e.Cancel = true; // not showing up } else { XamGrid grid = elements[0]; PerformerResult currentrow = (MyEntity)grid.ActiveCell.Row.Data; ContextMenuService.GetManager(xamGrid).ContextMenu.Items.Clear(); ContextMenuService.GetManager(xamGrid).ContextMenu.ItemsSource = MyList); } }then run the app. Only okay at first time click on any cell in xamGrid. If click on any cell again, will get error said:Operation not supported on read-only collection.How to resolve this problem?
Hello, With an ItemsSource, instead of trying to add/remove elements using the Items collection, you should modify your underlying collection instead. Valerie
With an ItemsSource, instead of trying to add/remove elements using the Items collection, you should modify your underlying collection instead.
Valerie
Hello,
Do you have any other questions regarding this matter?