Radial Menu and Passing parameter

Thread is closed for posting
2 posts, 0 answers
  1. Ahamd
    Ahamd avatar
    2 posts
    Member since:
    Jan 2012

    Posted 30 May 2015 Link to this post

    Dear All;


    I tried a radial menu and it's working ok, but i failed to pass parameter from a textblock value using 


    when i pass static text, it's working, not when using a value from the textblock

    my code is

    1.<TextBlock x:Name="txtTest" Canvas.Left="83" TextWrapping="Wrap" Text="Hello" Canvas.Top="19"/>       
    2.            <Primitives:RadRadialMenu x:Name="mnuShops" Height="108" Width="102"  RenderTransformOrigin="0.506,0.494" Canvas.Top="-126" Canvas.Left="-132" FontSize="16">
    3.                <Primitives:RadialMenuItem x:Name="radialMenuItem" Header="FirstNode"  Command="{Binding FirstCommand, Source={StaticResource Commands}}" CommandParameter="{Binding Text, ElementName=txtTest}"/>
    4.                <Primitives:RadialMenuItem Header="Second Node"/>          
    5.            </Primitives:RadRadialMenu>

  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 03 Jun 2015 Link to this post

    Hi Ahamd,

    You are correct. The CommandParameter does not support such kind of binding. 

    Please keep in mind that the RadialMenuItem is not a DependencyObject. This means that ordinary binding will not work. 

    You have two options to bind the CommandParameter property. First is to use StaticResource binding similar to this:

        <local:CustomItemCommand x:Key="customCommand" />
        <local:ViewModel x:Key="viewModel" />
    <StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="0 40 0 0">
        <Primitives:RadRadialMenu DataContext="{StaticResource viewModel}">
            <Primitives:RadialMenuItem Header="Binding"
                                       Command="{StaticResource customCommand}"
                                       CommandParameter="{Binding Source={StaticResource viewModel}, Path=TestString}" />
    The other approach would be to use a custom attached property.

    I hope this information is helpful. Do not hesitate to contact us again if you need any further assistance.

    Pavel R. Pavlov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top