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

Databinding to column ActualWidth in nested grid

2 Answers 131 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 19 Sep 2012, 08:00 PM
I have a radgridview with a nested radgridview in the RowDetails.
I would like to bind a column width in the nested gridview to a
column ActualWidth in the parent gridview. I tried using a simple 
elementName binding and giving the column a name, but that doesn't 
seem to work. Is there a better way to do this, or another way to
reference the grids column that I am missing.

Cheers,
James

<
DataTemplate x:Key="DetailGrid">
    <telerik:RadGridView>      
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn
                Width="{Binding ActualWidth, ElementName=MainGridFirstColumn}" />          
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
</DataTemplate>
 
<telerik:RadGridView Name="MainGrid" RowDetailsTemplate="{DynamicResource DetailGrid}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
                                Name="MainGridFirstColumn"
                    Width="*"/>
            </telerik:RadGridView.Columns>
</telerik:RadGridView>

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 20 Sep 2012, 05:22 AM
Hello,

 Maybe it will be better to use RadTreeListView in your case if you have the same columns in parent and child grid. 

All the best,
Vlad
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
James
Top achievements
Rank 1
answered on 21 Sep 2012, 12:02 AM
Using x:Reference instead of ElementName worked.
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Vlad
Telerik team
James
Top achievements
Rank 1
Share this question
or