This is a migrated thread and some comments may be shown as answers.
RadMenuItems-ERROR:"That is already exits the rad menu item name"
7 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Huy Truong The
Top achievements
Rank 1
Huy Truong The asked on 18 Aug 2009, 04:00 AM

Hello,

I’m having a trouble in using the RadMenuItem. I have 3 RadMenuItems on a  R form .

After I close the Form R and re-enter the a R form by new an instance of a R form. There a exception errors “That is already exits the rad menu item name “ I use in the R form.

I think all the radmenuItem is declare static scope so it  not still exists after I close or dipose the form

Could you please tell me why it happened? Thank you

Regards,

Huy

7 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 18 Aug 2009, 01:25 PM
Hi,

This problem is caused by a bug in the Silverlight Popup control that is triggered in certain scenarios. To avoid it, you should not set x:Name on RadMenuItem controls.

All the best,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Huy Truong The
Top achievements
Rank 1
answered on 20 Aug 2009, 02:54 AM
Thank you for your feedback
Best regards,
Huy
0
Huy Truong The
Top achievements
Rank 1
answered on 20 Aug 2009, 03:01 AM
Hello,
Thank you for your feedback. But I sill have this problem with radmenuitem. Here is my codes:
SilverlightControl1.xaml
<UserControl x:Class="SilverlightApplication2.SilverlightControl1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    Width="400" Height="300"
    <Grid x:Name="LayoutRoot" Background="White"
        <Button x:Name="btnView"  Content="Show Menu"  Click="btnView_Click"   ></Button
 
    </Grid> 
</UserControl> 
 


SilverlightControl1.xaml.cs
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
 
namespace SilverlightApplication2 
    public partial class SilverlightControl1 : UserControl 
    { 
        public SilverlightControl1() 
        { 
            InitializeComponent(); 
        } 
 
        private void btnView_Click(object sender, RoutedEventArgs e) 
        { 
            Page a = new Page(); 
            App.Navigate(a); 
        } 
    } 
 

Page.xaml
<UserControl x:Class="SilverlightApplication2.Page" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"              
    Width="400" Height="300"
    <Grid x:Name="LayoutRoot" Background="White"
        <Border Grid.Row="0" Grid.Column="0" x:Name="HeaderLeft"
 
            <telerikNavigation:RadMenu VerticalAlignment="Center"   
                                         HorizontalAlignment="Left" x:Name="menuQuick" 
                                         ClickToOpen="True"
        
 
 
                <telerikNavigation:RadMenuItem x:Name="menuOrganization"  > 
                    <telerikNavigation:RadMenuItem.Header> 
                        <TextBlock Foreground="Black" Text="Organization"></TextBlock> 
                    </telerikNavigation:RadMenuItem.Header> 
                    <telerikNavigation:RadMenuItem x:Name="menuOrganizationForm" > 
                        <telerikNavigation:RadMenuItem.Header> 
                            <TextBlock Foreground="Black" Text="OrganizationForm"></TextBlock> 
                        </telerikNavigation:RadMenuItem.Header> 
                    </telerikNavigation:RadMenuItem> 
                </telerikNavigation:RadMenuItem> 
                 
                <telerikNavigation:RadMenuItem x:Name="menuPersonal" > 
                    <telerikNavigation:RadMenuItem.Header> 
                        <TextBlock Foreground="Black" Text="Personal"></TextBlock> 
                    </telerikNavigation:RadMenuItem.Header> 
                    <telerikNavigation:RadMenuItem x:Name="menuPersonalCard"  > 
                        <telerikNavigation:RadMenuItem.Header> 
                            <TextBlock Foreground="Black" Text="PersonalCard"></TextBlock> 
                        </telerikNavigation:RadMenuItem.Header> 
                    </telerikNavigation:RadMenuItem> 
                </telerikNavigation:RadMenuItem> 
                 
                <telerikNavigation:RadMenuItem x:Name="menuSystemConfig" > 
                    <telerikNavigation:RadMenuItem.Header> 
                        <TextBlock Foreground="Black" Text="SystemConfig"></TextBlock> 
                    </telerikNavigation:RadMenuItem.Header> 
                    <telerikNavigation:RadMenuItem x:Name="menuOrgParam" > 
                        <telerikNavigation:RadMenuItem.Header> 
                            <TextBlock Foreground="Black" Text="OrgParam"></TextBlock> 
                        </telerikNavigation:RadMenuItem.Header> 
                        <telerikNavigation:RadMenuItem x:Name="menuSeverConfig" > 
                            <telerikNavigation:RadMenuItem.Header> 
                                <TextBlock Foreground="Black" Text="SeverConfig"></TextBlock> 
                            </telerikNavigation:RadMenuItem.Header> 
                            <telerikNavigation:RadMenuItem x:Name="menuPathInfo" > 
                                <telerikNavigation:RadMenuItem.Header> 
                                    <TextBlock Foreground="Black" Text="PathInfo"></TextBlock> 
                                </telerikNavigation:RadMenuItem.Header> 
                            </telerikNavigation:RadMenuItem> 
                        </telerikNavigation:RadMenuItem> 
                         
                        <telerikNavigation:RadMenuItem x:Name="menuApplicationConfig" > 
                            <telerikNavigation:RadMenuItem.Header> 
                                <TextBlock Foreground="Black" Text="ApplicationConfig"></TextBlock> 
                            </telerikNavigation:RadMenuItem.Header> 
                            <telerikNavigation:RadMenuItem  x:Name="menuOrganizationInfo"    > 
                                <telerikNavigation:RadMenuItem.Header> 
                                    <TextBlock Foreground="Black" Text="OrganizationInfo"></TextBlock> 
                                </telerikNavigation:RadMenuItem.Header> 
                            </telerikNavigation:RadMenuItem> 
                            <telerikNavigation:RadMenuItem x:Name="menuInfoShow" Click="menuInfoShow_Click"  > 
                                <telerikNavigation:RadMenuItem.Header> 
                                    <TextBlock Foreground="Black" Text="SHow Buton Form" ></TextBlock
                                </telerikNavigation:RadMenuItem.Header> 
                            </telerikNavigation:RadMenuItem> 
                           
                        </telerikNavigation:RadMenuItem> 
                    </telerikNavigation:RadMenuItem> 
                </telerikNavigation:RadMenuItem> 
            </telerikNavigation:RadMenu> 
 
        </Border> 
    </Grid> 
</UserControl> 
 


Page.xaml.cs
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
 
namespace SilverlightApplication2 
    public partial class Page : UserControl 
    { 
        public Page() 
        { 
            InitializeComponent(); 
        } 
 
        private void menuInfoShow_Click(object sender, RoutedEventArgs e) 
        { 
            SilverlightControl1 s = new SilverlightControl1(); 
            App.Navigate(s); 
        } 
    } 
 


I do not know why it still has this problem because I think menu control is a very common control. Could you please help me figure out why it is? Thank you very much

Huy




0
Huy Truong The
Top achievements
Rank 1
answered on 21 Aug 2009, 07:44 AM
Hello Valeri,
Could you check my problem raised before? Does telerik menu not solve this problem?
I am waiting for your feedback. Thank you very much
Regards,
Huy
0
Valeri Hristov
Telerik team
answered on 21 Aug 2009, 07:49 AM
Hi Huy,

If you remove the x:Name attributes from all RadMenuItem controls the problem will go away.

Sincerely yours,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Huy Truong The
Top achievements
Rank 1
answered on 21 Aug 2009, 10:56 AM
Hi Valeri ,

Normally, x:Name attribute from a control is used for keeping the control identity in common. It really surprises that i can not use this attribute in your RadMenuItem and the control problem is coming for this reason.
In this case, when using this RadMenuItem, what is the way you keep the each menu item identity? I wish it is not so weird.
Thank you for your help

Huy
0
Valeri Hristov
Telerik team
answered on 21 Aug 2009, 11:38 AM
Hello Huy,

I fully understand that the problem with the x:Name attribute is a serious limitation, but unfortunately we were unable to find a way to solve it. I want to say again that it is a bug in the Silverlight Popup control, that can be reproduced without RadMenu or any Telerik control.

To keep the identity of the RadMenuItems I would recommend two workarounds:
1) Use the Tag property to keep a string or other object that will uniqueli identify the item.
2) Databind RadMenu and use the data objects, instead of RadMenuItems in your application logic:
http://demos.telerik.com/silverlight/#Menu/DataBinding

I personally would recommend data-binding, because it provides much greater control and UI/logic separation. Of course, if you want just a simple menu, the Tag property would be better.

Regards,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Menu
Asked by
Huy Truong The
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Huy Truong The
Top achievements
Rank 1
Share this question
or