Buttons inside RadExpander

2 posts, 0 answers
  1. Sivakumar
    Sivakumar avatar
    6 posts
    Member since:
    Jul 2010

    Posted 25 Sep 2013 Link to this post


    I have a button inside the RadExpander and have the command property as well. However I am getting the error in the output saying the command property is not found in my view model. I have set the relative source to the rad expander as well.

    The thing is I have the button inside the Rad Expander header and have the command property and it is working perfectly.

    I am using Prism Framework with MEF.

    Please see below the code,

    <telerik:RadExpander Grid.Row="0" Margin="5" >



    <telerik:RadButton Margin="0,0,10,0" Style="{DynamicResource RadImageButton}"

    Command="{Binding Path=DataContext.CollapseCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=telerikinput:RadExpander}}"

    Visibility="{Binding Converter={StaticResource VisibilityConverter}, Path=IsHeaderExpand}"> 


    <telerik:RadButton Margin="0,0,10,0" Style="{DynamicResource RadImageButton}"

    Command="{Binding Path=DataContext.ExpandCommand,RelativeSource={RelativeSource FindAncestor, AncestorType=telerikinput:RadExpander}}"

    Visibility="{Binding Converter={StaticResource VisibilityConverter}, Path=IsCollapse}">


    <Label Content="Search Criteria" Margin="40,10,0,0" Style="{DynamicResource LabelBoldContentStyle}" HorizontalAlignment="Left"/>



    <Grid Margin="5">

    <Button Grid.Row="7" Grid.Column="7" Height="28" Width="50" Margin="0,0,46,0"

    Content="Search" HorizontalAlignment="Right" FontWeight="Bold"

    Command="{Binding Path=DataContext.SearchComamnd, RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadExpander}}"/>


    Please let me know what I am missing in my code ?


  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1167 posts

    Posted 30 Sep 2013 Link to this post

    Hi Sivakumar,

    As far as I understand your issue is that an error has been printed to the Output Console of your VS and you say although this error is registered, the command works as expected at run-time.

    This error may be printed because the DataContext of the control is not yet loaded by the time the binding expressions are being evaluated. This may be caused by the PrismFramework and its on demand loading (injection).

    Since the corresponding command can be invoked by the button at run-time, you can ignore that error.

    I hope this clarifies your concerns.

    Pavel R. Pavlov
    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
Back to Top