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

Hide GridViewToggleRowDetailsButton depending on ViewModel property

1 Answer 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 18 May 2011, 10:52 AM
Hi!

I am trying to hide the GridViewToggleRowDetailsButton depending on a property ("HasDetails") in the Viewmodel.
When the button is clicked I want to dynamically load the data for the rowdetails from a database.

In wpf I can achive this by using the folllowing Columndefinition:
<telerik:GridViewToggleRowDetailsColumn x:Uid="telerik:GridViewToggleRowDetailsColumn_1"  IsReorderable="False" IsResizable="False">
    <telerik:GridViewToggleRowDetailsColumn.ToggleButtonStyle>
        <Style x:Uid="Style_2" TargetType="telerik:GridViewToggleButton">
            <Setter x:Uid="Setter_4" Property="Visibility" Value="{Binding Path=HasDetails,Converter={StaticResource BoolToVisibilityConverter}}" />
            <Setter x:Uid="Setter_5" Property="Command" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, Path=DataContext.ShowProtocolsCommand}"/>
             <Setter x:Uid="Setter_6" Property="CommandParameter" Value="{Binding }"/>
        </Style>
    </telerik:GridViewToggleRowDetailsColumn.ToggleButtonStyle>
</telerik:GridViewToggleRowDetailsColumn>

How can I do the same in Silverlight?

Best Regards,
Matthias

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 20 May 2011, 11:54 AM
Hello Matthias,

Silverlight 4 internally does not support bindings in styles, so this approach won't work in silverlight due to this framewrok limitation. However, I have prepared an example project that illustrates how to retemplate GridViewDataColumn, in order to achieve GridViewToggleRowDetailsColumn's functionality.

Regards,
Ivan Ivanov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Matthias
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or