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

IsReadOnly in Hierarchical Grid

1 Answer 17 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stuart Cotts
Top achievements
Rank 1
Stuart Cotts asked on 19 Dec 2010, 07:17 AM
Below is a shortened (some columns/styling removed) Grid I am workingon, I am trying to have an external source set IsReadOnly on the Parent and hierarchical grid.

The binding sets "cueSheetGrid" to IsReadOnly (InEditMode is a propery from DataContext) but the child grid (EventView) remains editable, I have not found a way to bind the child to the parent grid and the ItemSource is different for the two grids.

Any ideas?

 
<tGrid:RadGridView 
    IsReadOnly="{Binding InEditMode}"                      
    x:Name="cueSheetGrid"
    HorizontalAlignment="Stretch" 
    RowDetailsVisibilityMode="Collapsed" 
    AlternationCount="0" 
    RowIndicatorVisibility="Collapsed" 
    DragElementAction="None" 
    AreRowDetailsFrozen="False" 
    CanUserFreezeColumns="True" >
      
    <tGrid:RadGridView.ChildTableDefinitions>
        <tGrid:GridViewTableDefinition>
            <tGrid:GridViewTableDefinition.Relation>
                <tData:PropertyRelation 
                    ParentPropertyName="CueEvents"/>
            </tGrid:GridViewTableDefinition.Relation>
        </tGrid:GridViewTableDefinition>
    </tGrid:RadGridView.ChildTableDefinitions>
      
    <tGrid:RadGridView.Columns>
        <tGrid:GridViewDataColumn 
            DataMemberBinding="{Binding CueNum}" 
            Header="Cue Number  "/>
        <tGrid:GridViewDataColumn 
            DataMemberBinding="{Binding Label}"
            Header="Label  "/>
    </tGrid:RadGridView.Columns>
      
      
    <tGrid:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
            <tGrid:RadGridView
                x:Name="EventView"
                ItemsSource="{Binding CueEvents}" 
                HeaderRowStyle="{DynamicResource MyHeaderRowStyle}"
                Style="{DynamicResource GridStyleDefault}"
                RowStyle="{DynamicResource EventRowStyle}"
                AlternateRowStyle="{DynamicResource EventAltRowStyle}"                        
                AlternationCount="2" >
                  
                <tGrid:RadGridView.Columns>
                    <tGrid:GridViewDataColumn
                        IsReadOnly="True"
                        DataMemberBinding="{Binding Machine.Name}"
                        Header="Machine  "/>
                    <tGrid:GridViewDataColumn
                        DataMemberBinding="{Binding Position}"
                        Header="Position  "/>
                    <tGrid:GridViewDataColumn
                        DataMemberBinding="{Binding Position}"
                        Header="Position  "/>
                </tGrid:RadGridView.Columns>
                  
            </tGrid:RadGridView>
        </DataTemplate>
    </tGrid:RadGridView.HierarchyChildTemplate>
</tGrid:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Stuart Cotts
Top achievements
Rank 1
answered on 19 Dec 2010, 07:43 AM
I got it, my first attempts to use RelativeSource failed but I finally got it.
Tags
GridView
Asked by
Stuart Cotts
Top achievements
Rank 1
Answers by
Stuart Cotts
Top achievements
Rank 1
Share this question
or