RadMenuItems-ERROR:"That is already exits the rad menu item name"

8 posts, 0 answers
  1. Huy Truong The
    Huy Truong The avatar
    32 posts
    Member since:
    Mar 2008

    Posted 17 Aug 2009 Link to this post

    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

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 18 Aug 2009 Link to this post

    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.
  3. DevCraft banner
  4. Huy Truong The
    Huy Truong The avatar
    32 posts
    Member since:
    Mar 2008

    Posted 19 Aug 2009 Link to this post

    Thank you for your feedback
    Best regards,
    Huy
  5. Huy Truong The
    Huy Truong The avatar
    32 posts
    Member since:
    Mar 2008

    Posted 19 Aug 2009 Link to this post

    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
    1 using System; 
    2 using System.Collections.Generic; 
    3 using System.Linq; 
    4 using System.Net; 
    5 using System.Windows; 
    6 using System.Windows.Controls; 
    7 using System.Windows.Documents; 
    8 using System.Windows.Input; 
    9 using System.Windows.Media; 
    10 using System.Windows.Media.Animation; 
    11 using System.Windows.Shapes; 
    12  
    13 namespace SilverlightApplication2 
    14
    15     public partial class Page : UserControl 
    16     { 
    17         public Page() 
    18         { 
    19             InitializeComponent(); 
    20         } 
    21  
    22         private void menuInfoShow_Click(object sender, RoutedEventArgs e) 
    23         { 
    24             SilverlightControl1 s = new SilverlightControl1(); 
    25             App.Navigate(s); 
    26         } 
    27     } 
    28
    29  


    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




  6. Huy Truong The
    Huy Truong The avatar
    32 posts
    Member since:
    Mar 2008

    Posted 21 Aug 2009 Link to this post

    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
  7. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 21 Aug 2009 Link to this post

    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.
  8. Huy Truong The
    Huy Truong The avatar
    32 posts
    Member since:
    Mar 2008

    Posted 21 Aug 2009 Link to this post

    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
  9. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 21 Aug 2009 Link to this post

    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.
Back to Top
DevCraft banner