RadMenuItem can only bind two times?

3 posts, 1 answers
  1. J
    J avatar
    4 posts
    Member since:
    Aug 2012

    Posted 30 Aug 2013 Link to this post

    <UserControl x:Class="RadControlsSilverlightApp1.MainPage"
            mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
        <Grid x:Name="LayoutRoot">
            <telerik:RadMenu Margin="46,132,58,0" VerticalAlignment="Top">
                <telerik:RadMenuItem Header="Item 1">
                    <telerik:RadMenuItem Header="Sub Item 1" Click="RadMenuItem_Click"/>
                    <telerik:RadMenuItem Header="Sub Item 2" Click="RadMenuItem_Click_1"/>
                </telerik:RadMenuItem>
                <telerik:RadMenuItem x:Name="radMenuItem" Header="Item 2">
                    <telerik:RadMenuItem Header="Sub Item 3"/>
                    <telerik:RadMenuItem Header="Sub Item 4"/>
                    <telerik:RadMenuItem Header="Sub Item 5"/>
                </telerik:RadMenuItem>
                <telerik:RadMenuItem Header="Item 3" IsEnabled="{Binding IsEnabled, ElementName=radMenuItem}">
                    <telerik:RadMenuItem Header="Sub Item 3"/>
                    <telerik:RadMenuItem Header="Sub Item 4"/>
                    <telerik:RadMenuItem Header="Sub Item 5"/>
                </telerik:RadMenuItem>
            </telerik:RadMenu>
     
        </Grid>
    </UserControl>

    using System.Windows.Controls;
     
    namespace RadControlsSilverlightApp1
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
            }
     
            private void RadMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                radMenuItem.IsEnabled = false;
            }
     
            private void RadMenuItem_Click_1(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                radMenuItem.IsEnabled = true;
            }
        }
    }

    work.gif is the run results
  2. Answer
    Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 03 Sep 2013 Link to this post

    Hi,

    You have to use TwoWay Binding for IsEnabled property. This is by design and whenever you want to use binding for this property, it should be TwoWay.
    <telerik:RadMenuItem Header="Item 3" IsEnabled="{Binding IsEnabled, ElementName=radMenuItem, Mode=TwoWay}">

    Hopefully this helps.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. J
    J avatar
    4 posts
    Member since:
    Aug 2012

    Posted 03 Sep 2013 Link to this post

    Perfect!Rosen Vladimirov,You're right, thank you!
Back to Top