This is a migrated thread and some comments may be shown as answers.

Buttons inside RadExpander

1 Answer 139 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Sivakumar
Top achievements
Rank 1
Sivakumar asked on 25 Sep 2013, 03:18 PM
Hi,

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:RadExpander.Header>

<Grid>

<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>

<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}">

</telerik:RadButton>

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

</Grid>

</telerik:RadExpander.Header>


<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}}"/>

</Grid>

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

Thnx,
Sivakumar

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 30 Sep 2013, 08:27 AM
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.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Tags
Buttons
Asked by
Sivakumar
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or