This question is locked. New answers and comments are not allowed.
Hi,
I need to generate the RadMenuItems dynamically at run time, therefore when ever the contextmenu is opening I delete the previous items and re add new items.
The issue I'm dealing with is the scrool bar. if user change scroll bar position, next time when context menu is opened, it still shows the previous scroll bar position.
Actually that make sense, because each time when the ContextMenu_Opened is fire , I just remove and re add items. I don't know how I can rest the scroll bar to move to the top of the list whenever the context menu opens?
I'd be thankful if you could assist me on this,
Best Regards,
Naseem
I need to generate the RadMenuItems dynamically at run time, therefore when ever the contextmenu is opening I delete the previous items and re add new items.
var sel = ((Telerik.Windows.Controls.RadMenuItem)BadRawContextMenu.Items.ToList();
foreach (var item in sel)
{
selItem.Items.Remove(item);
}
Telerik.Windows.Controls.RadMenuItem newItem;
foreach (var item in lstResult)
{
newItem = new Telerik.Windows.Controls.RadMenuItem() { Header = item.Title, IconTemplate = (System.Windows.DataTemplate)this.Resources["IconTemplateBestMatches"], Tag = item.Code };
newItem.Click += new Telerik.Windows.RadRoutedEventHandler(newItem_Click);
selItem.Items.Add(newItem);
}
The issue I'm dealing with is the scrool bar. if user change scroll bar position, next time when context menu is opened, it still shows the previous scroll bar position.
Actually that make sense, because each time when the ContextMenu_Opened is fire , I just remove and re add items. I don't know how I can rest the scroll bar to move to the top of the list whenever the context menu opens?
I'd be thankful if you could assist me on this,
Best Regards,
Naseem