Telerik Forums
UI for WPF Forum
1 answer
215 views
Hey Telerik!

I have been playing around with optimizing my xaml code for my controls and have ran into a question about performance.

Are both of these ways considered the same?  If the bottom is faster, how do I get my row height=60 in the Template to show below the list instead of below the first added item.

<Style x:Key="ccTemplate" TargetType="{x:Type ContentControl}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ContentControl}" >
                <Grid x:Name="listBoxGrid" TextOptions.TextFormattingMode="Display">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="200*"/>
                        <RowDefinition Height="60" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid Grid.ColumnSpan="6" >
                        <ContentPresenter />
                    </Grid>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
 
<Style x:Key="{x:Type control:ListBoxControl}" TargetType="{x:Type control:ListBoxControl}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <ContentControl Style="{StaticResource ccTemplate}" x:Name="cc">
                    <telerikNavigation:RadTreeView
                            Name="mainList"
                            ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ItemsSource}"
                            ItemTemplate="{DynamicResource MainDataTemplate}"
                            ItemContainerStyle="{DynamicResource MainStyle}"
                            MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MinWidth}"
                            ScrollViewer.HorizontalScrollBarVisibility="Auto"
                            BorderBrush="#FF00569F"
                            Background="{DynamicResource ListItemBackground}"
                            BorderThickness="1"
                            SelectionMode="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectionMode, FallbackValue=Single}"
                            IsDragDropEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDragDropEnabled, FallbackValue=False}"
                            IsDropPreviewLineEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropPreviewLineEnabled, FallbackValue=True}"
                            AllowDrop="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AllowDrop, FallbackValue=True}"
                            >
                    </telerikNavigation:RadTreeView>
                </ContentControl>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Vs.

<Style x:Key="{x:Type control:ListBoxControl}" TargetType="{x:Type control:ListBoxControl}">
       <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ItemsSource}" />
       <Setter Property="ItemTemplate" Value="{DynamicResource MainDataTemplate}"/>
       <Setter Property="ItemContainerStyle" Value="{DynamicResource MainStyle}"/>
       <Setter Property="BorderBrush" Value="#FF00569F"/>
       <Setter Property="Background" Value="{DynamicResource ListItemBackground}"/>
       <Setter Property="IsLineEnabled" Value="True"/>
       <Setter Property="IsRootLinesEnabled" Value="False"/>
       <Setter Property="BorderThickness" Value="1"/>
       <Setter Property="IsExpandOnSingleClickEnabled" Value="True" />
       <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource ValidationTemplate}" />
       <Setter Property="SelectionMode" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectionMode, FallbackValue=Single}" />
       <Setter Property="IsDragDropEnabled" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDragDropEnabled, FallbackValue=False}" />
       <Setter Property="IsDropPreviewLineEnabled" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropPreviewLineEnabled, FallbackValue=True}" />
       <Setter Property="AllowDrop" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AllowDrop, FallbackValue=True}" />
   </Style>

And adding the grid to the RadTreeTemplate

 <ControlTemplate x:Key="RadTreeViewMainItemControlTemplate" TargetType="{x:Type telerikNavigation:RadTreeViewItem}">
        <Grid x:Name="listBoxGrid" TextOptions.TextFormattingMode="Display">
            <Grid.RowDefinitions>
                <RowDefinition Height="200*"/>
                <RowDefinition Height="60" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="80" />
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid Grid.ColumnSpan="6" >
                <Grid x:Name="RootElement" MinWidth="300" Cursor="Hand">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid x:Name="HeaderRow" MinHeight="{TemplateBinding MinHeight}" SnapsToDevicePixels="True" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border Grid.ColumnSpan="6" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="0" />
                        <Border x:Name="MouseOverVisual" Opacity="0"  Grid.ColumnSpan="6" Background="{DynamicResource ListItemMouseOver}" BorderBrush="{DynamicResource ListItemMouseOverBorder}" BorderThickness="0" />

                        <Border x:Name="SelectionUnfocusedVisual" Visibility="Collapsed" Grid.ColumnSpan="6" BorderBrush="Transparent" Background="{DynamicResource ListItemUnSelect}" BorderThickness="0" />

                        <Border x:Name="SelectionVisual" Visibility="Collapsed" Grid.ColumnSpan="6" BorderBrush="{DynamicResource ListItemSelectBorder}" Background="{DynamicResource ListItemSelect}" BorderThickness="0" />

                        <StackPanel x:Name="IndentContainer" Orientation="Horizontal">
                            <Rectangle x:Name="IndentFirstVerticalLine" />
                        </StackPanel>
                        <Grid x:Name="ListRootContainer" HorizontalAlignment="Center" MinWidth="20" Grid.Column="1">
                            <ToggleButton Name="MainToggle" Style="{DynamicResource ExpanderStyle}" IsTabStop="False" IsChecked="{TemplateBinding IsExpanded}"/>
                            <Grid x:Name="LoadingVisual" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/>
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <Path Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeStartLineCap="Round" StrokeThickness="1" Width="10" Height="10" Data="M1,0A1,1,90,1,1,0,-1"/>
                                <Path Fill="{TemplateBinding Foreground}" Stretch="Fill" StrokeThickness="1" HorizontalAlignment="Left" Margin="5,-1.5,0,0" VerticalAlignment="Top" Width="4" Height="4" Data="M0,-1.1L0.1,-1 0,-0.9"/>
                            </Grid>
                        </Grid>
                        <CheckBox x:Name="CheckBoxElement" Margin="5,0,0,0" VerticalAlignment="Center" IsTabStop="False" Visibility="Collapsed" Grid.Column="2">
                        </CheckBox>
                        <RadioButton x:Name="RadioButtonElement" Margin="5,0,0,0" VerticalAlignment="Center" IsTabStop="False" Visibility="Collapsed" Grid.Column="2">
                        </RadioButton>
                        <Image x:Name="Image" HorizontalAlignment="Center" Margin="2" MaxHeight="16" MaxWidth="16" VerticalAlignment="Center" Grid.Column="3" Source="{TemplateBinding DefaultImageSrc}"/>
                        <Rectangle x:Name="FocusVisual"/>
                        <Grid Grid.Column="4" Grid.ColumnSpan="2">
                            <ContentPresenter x:Name="Header"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      Margin="{TemplateBinding Padding}"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                      ContentSource="Header"/>
                            <ContentPresenter x:Name="EditHeaderElement" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" ContentTemplate="{TemplateBinding HeaderEditTemplate}"/>
                        </Grid>
                    </Grid>
                    <Border BorderThickness="0 0 0 2" BorderBrush="{DynamicResource BottomListItem}" />
                    <ItemsPresenter x:Name="ItemsHost" Visibility="Collapsed" Grid.Row="1" DataContext="{Binding}" />
                    <Border BorderThickness="0 0 0 2" BorderBrush="{DynamicResource BottomListItem}" />

                </Grid>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsInEditMode" Value="True">
                <Setter Property="Visibility" TargetName="Header" Value="Collapsed"/>
                <Setter Property="Visibility" TargetName="EditHeaderElement" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Visibility" TargetName="SelectionVisual" Value="Visible"/>
                <Setter Property="BorderThickness" Value="1" />
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Visibility" TargetName="FocusVisual" Value="Visible"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Property="IsSelectionActive" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Opacity" TargetName="SelectionVisual" Value="1"/>
                <Setter Property="Visibility" TargetName="SelectionUnfocusedVisual" Value="Visible"/>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" TargetName="Header" Value="0.5"/>
            </Trigger>
            <Trigger Property="IsExpanded" Value="True">
                <Setter Property="Visibility" TargetName="ItemsHost" Value="Visible"/>
            </Trigger>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Visibility" TargetName="MainToggle" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsLoadingOnDemand" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Duration="00:00:01" RepeatBehavior="Forever" Storyboard.TargetName="LoadingVisualAngleTransform" Storyboard.TargetProperty="Angle" From="0" To="359"/>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Setter Property="Visibility" TargetName="LoadingVisual" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsDragOver" Value="True">
                <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
            </Trigger>
            <Trigger Property="IsMouseOver" SourceName="HeaderRow" Value="True">
                <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
<ControlTemplate x:Key="RadTreeViewMainItemControlTemplate" TargetType="{x:Type telerikNavigation:RadTreeViewItem}">
       <Grid x:Name="listBoxGrid" TextOptions.TextFormattingMode="Display">
           <Grid.RowDefinitions>
               <RowDefinition Height="200*"/>
               <RowDefinition Height="60" />
           </Grid.RowDefinitions>
           <Grid.ColumnDefinitions>
               <ColumnDefinition Width="80" />
               <ColumnDefinition Width="80" />
               <ColumnDefinition Width="80" />
               <ColumnDefinition Width="80" />
               <ColumnDefinition/>
           </Grid.ColumnDefinitions>
           <Grid Grid.ColumnSpan="6" >
               <Grid x:Name="RootElement" MinWidth="300" Cursor="Hand">
                   <Grid.RowDefinitions>
                       <RowDefinition Height="Auto"/>
                       <RowDefinition/>
                   </Grid.RowDefinitions>
                   <Grid x:Name="HeaderRow" MinHeight="{TemplateBinding MinHeight}" SnapsToDevicePixels="True" Background="Transparent">
                       <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="*"/>
                       </Grid.ColumnDefinitions>
                       <Border Grid.ColumnSpan="6" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="0" />
                       <Border x:Name="MouseOverVisual" Opacity="0"  Grid.ColumnSpan="6" Background="{DynamicResource ListItemMouseOver}" BorderBrush="{DynamicResource ListItemMouseOverBorder}" BorderThickness="0" />
 
                       <Border x:Name="SelectionUnfocusedVisual" Visibility="Collapsed" Grid.ColumnSpan="6" BorderBrush="Transparent" Background="{DynamicResource ListItemUnSelect}" BorderThickness="0" />
 
                       <Border x:Name="SelectionVisual" Visibility="Collapsed" Grid.ColumnSpan="6" BorderBrush="{DynamicResource ListItemSelectBorder}" Background="{DynamicResource ListItemSelect}" BorderThickness="0" />
 
                       <StackPanel x:Name="IndentContainer" Orientation="Horizontal">
                           <Rectangle x:Name="IndentFirstVerticalLine" />
                       </StackPanel>
                       <Grid x:Name="ListRootContainer" HorizontalAlignment="Center" MinWidth="20" Grid.Column="1">
                           <ToggleButton Name="MainToggle" Style="{DynamicResource ExpanderStyle}" IsTabStop="False" IsChecked="{TemplateBinding IsExpanded}"/>
                           <Grid x:Name="LoadingVisual" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
                               <Grid.RenderTransform>
                                   <TransformGroup>
                                       <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/>
                                   </TransformGroup>
                               </Grid.RenderTransform>
                               <Path Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeStartLineCap="Round" StrokeThickness="1" Width="10" Height="10" Data="M1,0A1,1,90,1,1,0,-1"/>
                               <Path Fill="{TemplateBinding Foreground}" Stretch="Fill" StrokeThickness="1" HorizontalAlignment="Left" Margin="5,-1.5,0,0" VerticalAlignment="Top" Width="4" Height="4" Data="M0,-1.1L0.1,-1 0,-0.9"/>
                           </Grid>
                       </Grid>
                       <CheckBox x:Name="CheckBoxElement" Margin="5,0,0,0" VerticalAlignment="Center" IsTabStop="False" Visibility="Collapsed" Grid.Column="2">
                       </CheckBox>
                       <RadioButton x:Name="RadioButtonElement" Margin="5,0,0,0" VerticalAlignment="Center" IsTabStop="False" Visibility="Collapsed" Grid.Column="2">
                       </RadioButton>
                       <Image x:Name="Image" HorizontalAlignment="Center" Margin="2" MaxHeight="16" MaxWidth="16" VerticalAlignment="Center" Grid.Column="3" Source="{TemplateBinding DefaultImageSrc}"/>
                       <Rectangle x:Name="FocusVisual"/>
                       <Grid Grid.Column="4" Grid.ColumnSpan="2">
                           <ContentPresenter x:Name="Header"
                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                     Margin="{TemplateBinding Padding}"
                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                     ContentSource="Header"/>
                           <ContentPresenter x:Name="EditHeaderElement" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" ContentTemplate="{TemplateBinding HeaderEditTemplate}"/>
                       </Grid>
                   </Grid>
                   <Border BorderThickness="0 0 0 2" BorderBrush="{DynamicResource BottomListItem}" />
                   <ItemsPresenter x:Name="ItemsHost" Visibility="Collapsed" Grid.Row="1" DataContext="{Binding}" />
                   <Border BorderThickness="0 0 0 2" BorderBrush="{DynamicResource BottomListItem}" />
 
               </Grid>
           </Grid>
       </Grid>
       <ControlTemplate.Triggers>
           <Trigger Property="IsInEditMode" Value="True">
               <Setter Property="Visibility" TargetName="Header" Value="Collapsed"/>
               <Setter Property="Visibility" TargetName="EditHeaderElement" Value="Visible"/>
           </Trigger>
           <Trigger Property="IsSelected" Value="True">
               <Setter Property="Visibility" TargetName="SelectionVisual" Value="Visible"/>
               <Setter Property="BorderThickness" Value="1" />
           </Trigger>
           <Trigger Property="IsFocused" Value="True">
               <Setter Property="Visibility" TargetName="FocusVisual" Value="Visible"/>
           </Trigger>
           <MultiTrigger>
               <MultiTrigger.Conditions>
                   <Condition Property="IsSelected" Value="True"/>
                   <Condition Property="IsSelectionActive" Value="False"/>
               </MultiTrigger.Conditions>
               <Setter Property="Opacity" TargetName="SelectionVisual" Value="1"/>
               <Setter Property="Visibility" TargetName="SelectionUnfocusedVisual" Value="Visible"/>
           </MultiTrigger>
           <Trigger Property="IsEnabled" Value="False">
               <Setter Property="Opacity" TargetName="Header" Value="0.5"/>
           </Trigger>
           <Trigger Property="IsExpanded" Value="True">
               <Setter Property="Visibility" TargetName="ItemsHost" Value="Visible"/>
           </Trigger>
           <Trigger Property="HasItems" Value="False">
               <Setter Property="Visibility" TargetName="MainToggle" Value="Collapsed" />
           </Trigger>
           <Trigger Property="IsLoadingOnDemand" Value="True">
               <Trigger.EnterActions>
                   <BeginStoryboard>
                       <Storyboard>
                           <DoubleAnimation Duration="00:00:01" RepeatBehavior="Forever" Storyboard.TargetName="LoadingVisualAngleTransform" Storyboard.TargetProperty="Angle" From="0" To="359"/>
                       </Storyboard>
                   </BeginStoryboard>
               </Trigger.EnterActions>
               <Setter Property="Visibility" TargetName="LoadingVisual" Value="Visible"/>
           </Trigger>
           <Trigger Property="IsDragOver" Value="True">
               <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
           </Trigger>
           <Trigger Property="IsMouseOver" SourceName="HeaderRow" Value="True">
               <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
           </Trigger>
       </ControlTemplate.Triggers>
   </ControlTemplate>


Petar Mladenov
Telerik team
 answered on 20 Dec 2010
2 answers
57 views
I'm changing the default behaviour of the RadGridView so that pressing delete does not delete the row but instead clears the selected cells content (excel style behaviour), i've also remapped delete to shift+delete. Everything is working fine, except for the fact that i can't seem to be able to clear the current cell programmatically. Here is the code in my custom command (simple 1.st ver):

        private void ClearCurrentCell(object obj)
        {
            if (_grid.CurrentCell == null)
                return;

            bool wasInEditMode = _grid.CurrentCell.IsInEditMode;

            if (!wasInEditMode)
                _grid.CurrentCell.BeginEdit();

            _grid.CurrentCell.Value = null;

            if (!wasInEditMode && _grid.CurrentCell.IsValid)
                _grid.CurrentCell.CommitEdit();
        }

But the cell revers to the bound value upon commit. How can I achieve this effect? Remember that I don't know the type of datasource bound to the cell.
Marius
Top achievements
Rank 1
 answered on 20 Dec 2010
1 answer
256 views
hello,

I would like to be able to change header text at runtime in a gridview

1- is it possible to edit headers ?
2- I would like to open a dialog window when the user clicks on a header. how can i get the click event on a header cell ?

best regards
thibaut
Vanya Pavlova
Telerik team
 answered on 20 Dec 2010
1 answer
145 views
Hi Telerik Team,

I have added telerik TreeListView control in my application. Now I need to edit some columns while application is running. How I can achieve this functionality? I need to edit as well as get that edited data back for further processing. How can I do this?

Thanks
Vanya Pavlova
Telerik team
 answered on 20 Dec 2010
3 answers
196 views
Hi I am using AddingNewDataItem event for radgrid view ,
    But i am unable to delete the selected row.
   also suggest me how to get and set a GridRow.
 
Thanks,
Swathi.
Maya
Telerik team
 answered on 20 Dec 2010
7 answers
134 views
What are the future plans for validation with GridView?  Do you plan to support multiple levels of validation, such as errors/warnings/information?  I have a situation where my customers want to be warned of a value differential, but still want to be able to save their data.
Nedyalko Nikolov
Telerik team
 answered on 20 Dec 2010
1 answer
119 views
I am currently defining the ChildTableDefinition item source to a List ("Children").  The number of items in the list is editable on the parent item and can cause large updates (which is why I am using a List and not an Observable collection).  When the user modifies the number of child elements we regenerate the List and then issue a property change notification for the Children property.  

When the user transitions the number of children from a non-zero to a 0 the expander control remains (although trying to expand it does not show any children).  Alternatively transitioning from a 0 to a non-zero does not create an expander control.

Is there a way to update the expander control to reflect transition to having children aside from using an ObservableCollection (it worked when I was using one but the performance was not desirable)?

Thanks
Vlad
Telerik team
 answered on 20 Dec 2010
3 answers
222 views
We were using the Microsoft TabControl and when we had the TabStripPlacement set to left, it put the tabs on the left and towards the top of the space for tabs.

When I switched to the RadTabControl, the tabs are still on the left, but they have gone to the bottom of the tab area. How do I get them back to the top. In other words Left-Top?
george
Top achievements
Rank 1
 answered on 20 Dec 2010
2 answers
201 views
Requirement:  GridView should display blank new row on load., once i typed any letter/number in the blank row first cell, another blank row should display in the grid. But the cursor should focus in the current row to enter the row data for all the remaining columns.

I tired to implement it, In GridView, Onload event i wrote BeginInsert() method to display blank row in the grid.  Cursor is focus on blank row first cell.
In KeyUp event, i wrote BeginInsert() method to display another blank row in the grid. It is displaying another new blank row but cursor is focus on 2 row first cell.

How i do reset the cursor focus to current (first) row current (first) cell to enter the first row data for all the remaining columns?







Anjan Nimmana
Top achievements
Rank 1
 answered on 20 Dec 2010
1 answer
122 views
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>
Stuart Cotts
Top achievements
Rank 1
 answered on 19 Dec 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?