This question is locked. New answers and comments are not allowed.
Hi..
We are using telerik rad menu control to list out menu items in silverlight project . Sometimes it's working well, but sometimes it's shows control error message.
In my project we have Rad treeview , if we select a Rad treeview item, it will open and the title of the treeview item should add in RadMenu items. If I mouseover it on RadMenu it will show the menu items what are all we added. And close the treeview item which is opened. Then, again we are open the same treeview item.
Now, the title of treeview item added successfully in RadMenu items in code side using break points. But In design, If I mouseover on RadMenu, it's not show the RadMenu items what are all added. Instead It shows the control related error message box.
code for Add Menu item in RadMenu : Sample1.xaml.cs
**********************************************************************************************************************************************************************
private RadMenuItem AddChildRadMenuItem(RadMenuItem item, string text)
{
if (item == null)
return null;
RadMenuItem child = new RadMenuItem();
child.Click += (s, e) => MenuItemShowWindowClick(s, e);
child.Header = text;
foreach (RadMenuItem menuItem in item.Items)
menuItem.IsChecked = false;
item.Items.Add(child);
child.IsChecked = true;
return child;
}
**********************************************************************************************************************************************************************
Code for remove menu item for radmenu : Sample1.xaml.cs
private void RemoveRadMenuItem(string name)
{
WindowsMenuItem.IsEnabled = true;
App.checkwindow = false;
for (int i = 0; i < WindowsMenuItem.Items.Count; i++)
{
RadMenuItem menuItem = (RadMenuItem)WindowsMenuItem.Items[i];
string menuHeader = (menuItem.Header == null) ? "" : menuItem.Header.ToString();
if (string.Compare(menuHeader, name, CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
WindowsMenuItem.Items.Remove(menuItem);
menuItem.Click -= (s, e) => MenuItemShowWindowClick(s, e);
}
}
if (WindowsMenuItem.Items.Count == 0)
{
WindowsMenuItem.IsEnabled = false;
App.checkwindow = true;
return;
}
if (((WindowsMenuItem.Items[WindowsMenuItem.Items.Count - 1]) as RadMenuItem).IsCheckable)
((WindowsMenuItem.Items[WindowsMenuItem.Items.Count - 1]) as RadMenuItem).IsChecked = true;
}
***********************************************************************************************************************************************************************
code for select item of RadMenu: Sample1.xaml.cs
private void MenuItemShowWindowClick(object sender, RoutedEventArgs e)
{
RadMenuItem radMenuItem = (sender as RadMenuItem);
if (radMenuItem == null)
throw new InvalidOperationException("Object menu raise exception in method Click.");
foreach (RadDocumentPane documentPane in DiagramPaneGroup.Items)
{
if (documentPane.Header is TabItemHeader)
{
TabItemHeader tabItemHeader = (TabItemHeader)documentPane.Header;
string documentName = tabItemHeader.Model.Text;
string Title_ = "";
if (documentName.Contains("*"))
{
string[] header = documentName.TrimStart().TrimEnd().Trim().Split('*');
Title_ = header[0].Trim().TrimStart().TrimEnd().ToString();
if (string.Compare(Title_, radMenuItem.Header.ToString(), CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
DiagramPaneGroup.SelectedItem = documentPane;
}
}
else if (string.Compare(documentName, radMenuItem.Header.ToString(), CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
DiagramPaneGroup.SelectedItem = documentPane;
}
}
}
}
***********************************************************************************************************************************************************************
Design code of silverlight Sample1.xaml file
<telerikNavigation:RadMenu x:Name="MainMenu" VerticalAlignment="Top" ClickToOpen="False" Grid.Row="0" >
..............
..................
<telerikNavigation:RadMenuItem Header="Window" x:Name="WindowsMenuItem"></telerikNavigation:RadMenuItem>
...................
.................
</telerikNavigation:RadMenu>
************************************************************************************************************************************************************************
We are using Q3 2010 version of Radcontrols. please try to send the solutions as soon as possible..
For clear information please see the below images ..
Thanks,
PRABAKARAN G.
We are using telerik rad menu control to list out menu items in silverlight project . Sometimes it's working well, but sometimes it's shows control error message.
In my project we have Rad treeview , if we select a Rad treeview item, it will open and the title of the treeview item should add in RadMenu items. If I mouseover it on RadMenu it will show the menu items what are all we added. And close the treeview item which is opened. Then, again we are open the same treeview item.
Now, the title of treeview item added successfully in RadMenu items in code side using break points. But In design, If I mouseover on RadMenu, it's not show the RadMenu items what are all added. Instead It shows the control related error message box.
code for Add Menu item in RadMenu : Sample1.xaml.cs
**********************************************************************************************************************************************************************
private RadMenuItem AddChildRadMenuItem(RadMenuItem item, string text)
{
if (item == null)
return null;
RadMenuItem child = new RadMenuItem();
child.Click += (s, e) => MenuItemShowWindowClick(s, e);
child.Header = text;
foreach (RadMenuItem menuItem in item.Items)
menuItem.IsChecked = false;
item.Items.Add(child);
child.IsChecked = true;
return child;
}
**********************************************************************************************************************************************************************
Code for remove menu item for radmenu : Sample1.xaml.cs
private void RemoveRadMenuItem(string name)
{
WindowsMenuItem.IsEnabled = true;
App.checkwindow = false;
for (int i = 0; i < WindowsMenuItem.Items.Count; i++)
{
RadMenuItem menuItem = (RadMenuItem)WindowsMenuItem.Items[i];
string menuHeader = (menuItem.Header == null) ? "" : menuItem.Header.ToString();
if (string.Compare(menuHeader, name, CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
WindowsMenuItem.Items.Remove(menuItem);
menuItem.Click -= (s, e) => MenuItemShowWindowClick(s, e);
}
}
if (WindowsMenuItem.Items.Count == 0)
{
WindowsMenuItem.IsEnabled = false;
App.checkwindow = true;
return;
}
if (((WindowsMenuItem.Items[WindowsMenuItem.Items.Count - 1]) as RadMenuItem).IsCheckable)
((WindowsMenuItem.Items[WindowsMenuItem.Items.Count - 1]) as RadMenuItem).IsChecked = true;
}
***********************************************************************************************************************************************************************
code for select item of RadMenu: Sample1.xaml.cs
private void MenuItemShowWindowClick(object sender, RoutedEventArgs e)
{
RadMenuItem radMenuItem = (sender as RadMenuItem);
if (radMenuItem == null)
throw new InvalidOperationException("Object menu raise exception in method Click.");
foreach (RadDocumentPane documentPane in DiagramPaneGroup.Items)
{
if (documentPane.Header is TabItemHeader)
{
TabItemHeader tabItemHeader = (TabItemHeader)documentPane.Header;
string documentName = tabItemHeader.Model.Text;
string Title_ = "";
if (documentName.Contains("*"))
{
string[] header = documentName.TrimStart().TrimEnd().Trim().Split('*');
Title_ = header[0].Trim().TrimStart().TrimEnd().ToString();
if (string.Compare(Title_, radMenuItem.Header.ToString(), CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
DiagramPaneGroup.SelectedItem = documentPane;
}
}
else if (string.Compare(documentName, radMenuItem.Header.ToString(), CultureInfo.CurrentCulture, CompareOptions.Ordinal) == 0)
{
DiagramPaneGroup.SelectedItem = documentPane;
}
}
}
}
***********************************************************************************************************************************************************************
Design code of silverlight Sample1.xaml file
<telerikNavigation:RadMenu x:Name="MainMenu" VerticalAlignment="Top" ClickToOpen="False" Grid.Row="0" >
..............
..................
<telerikNavigation:RadMenuItem Header="Window" x:Name="WindowsMenuItem"></telerikNavigation:RadMenuItem>
...................
.................
</telerikNavigation:RadMenu>
************************************************************************************************************************************************************************
We are using Q3 2010 version of Radcontrols. please try to send the solutions as soon as possible..
For clear information please see the below images ..
Thanks,
PRABAKARAN G.