PreviewDataRecordCreate for the intialization of the grid to control the expander which works well. However i would like to validate the expander when the user selects the row (selectinchanged event)
I have tried to cast to the ExpandableDataRecord but this is always null. I would like validate that the expander is valid i.e. i do have data for the child grid. I am currently calling a rebind of the grid view but this does not help. I dont want to remove the row and re-add it as that seems to be a hack.
Secondly is there an event when the user clicks on the expander (+-) as this does cause a selectionchanged event?
The last question is that there is allot of classes marked as deprecated such as ExpandableDataRecord is there mechanism to look at which classes we should use instead as the forum posts would refer to the old classes?
Kind Regards,
Clinton
| <telerik:RadTabControl ItemsSource="{Binding Workspaces}"> |
| <telerik:RadTabControl.Resources> |
| <Style TargetType="{x:Type telerik:RadTabItem}"> |
| <Setter Property="ContentTemplateSelector"> |
| <Setter.Value> |
| <local:TabItemContentTemplateSelector /> |
| </Setter.Value> |
| </Setter> |
| </Style> |
| </telerik:RadTabControl.Resources> |
| </telerik:RadTabControl> |
| <UserControl x:Class="SolutionQ.Eclipse.Silverlight.Content.Search.xxxx.xxxx.xxxxxxxx" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:dg="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" |
| xmlns:RadNav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" |
| xmlns:controls="clr-namespace:SolutionQ.Eclipse.Silverlight.Content.Controls" |
| xmlns:RadGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" |
| > |
| <Grid x:Name="LayoutRoot" Background="White"> |
| <Grid.RowDefinitions> |
| <!--xmlns:Ra=""--> |
| <RowDefinition Height="Auto" /> |
| <RowDefinition Height="1*" /> |
| </Grid.RowDefinitions> |
| <Grid.ColumnDefinitions> |
| <ColumnDefinition Width="1*" /> |
| </Grid.ColumnDefinitions> |
| <!-- Filtering ToolBar --> |
| <RadNav:RadToolBarTray Grid.Row="0" Grid.Column="0" Style="{StaticResource style_DataGridRadToolBarTray}"> |
| <RadNav:RadToolBar x:Name="rtb_Filter" Style="{StaticResource style_RadToolBar}"> |
| <!-- New Clause Button --> |
| <Button x:Name="btn_ExportToExcel" Tag="btn_ExportToExcel" Click="btn_Menu_Click" ToolTipService.ToolTip="Export to Excel Format"> |
| <controls:IconAndLabelControl Icon="Icons/PlaceHolderIcon.xaml" Label="Export To Excel" /> |
| </Button> |
| <Button x:Name="btn_ViewResults" Tag="btn_ViewResults" Click="btn_Menu_Click" ToolTipService.ToolTip="View Results"> |
| <controls:IconAndLabelControl Icon="Icons/PlaceHolderIcon.xaml" Label="View Results" /> |
| </Button> |
| </RadNav:RadToolBar> |
| </RadNav:RadToolBarTray> |
| <!--<dg:DataGrid x:Name="Result" Grid.Row="1" Grid.Column="0" AutoGenerateColumns="False" ItemsSource="{Binding Path=Items, Mode=TwoWay}" Style="{StaticResource style_GenericDataGrid}" CellStyle="{StaticResource style_GenericDataGridCell}" ColumnHeaderStyle="{StaticResource style_GenericDataGridColumnHeader_LeftAligned}" RowHeaderStyle="{StaticResource style_GenericDataGridRowHeader}" RowStyle="{StaticResource style_GenericDataGridRow}"> |
| </dg:DataGrid>--> |
| <RadGrid:RadGridView x:Name="radResult" Grid.Row="1" Grid.Column="0" AutoGenerateColumns="False" > |
| <!--ItemsSource="{Binding Path=Items, Mode=TwoWay}"--> |
| </RadGrid:RadGridView> |
| </Grid> |
| </UserControl> |
At code behind side I am using following namespaces:
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Net; |
| using System.Windows; |
| using System.Windows.Controls; |
| using System.Windows.Documents; |
| using System.Windows.Input; |
| using System.Windows.Media; |
| using System.Windows.Media.Animation; |
| using System.Windows.Shapes; |
| // Telerik using |
| using Telerik.Windows; |
| using Telerik.Windows.Data; |
| using Telerik.Windows.Controls; |
| using Telerik.Windows.Controls.GridView; |
| using Telerik.Windows.Controls.GridView.Cells; |
| // add using |
| using System.Collections.ObjectModel; |
| using System.Windows.Browser; |
| using System.ComponentModel; |
| using System.Collections; |
| using System.Windows.Controls.Primitives; |
| void tabPreview_Loaded(object sender, RoutedEventArgs e) |
| { |
| BuildColumns(); |
| } |
| private void BuildColumns() |
| { |
| this.radResult.Columns.Clear(); //<-- This method doesnt show in intellisense, neither Add method will show up here |
| } |
Am I doing anything wrong here?

| private void OnChildGridLoaded(object sender, RoutedEventArgs e) |
| { |
| // Pull data from the detail table based on the relation. |
| var dataRowView = (DataRowView)((RadGridView)sender).ParentRow.DataContext; |
| var ds = dataRowView.DataView.Table.DataSet; |
| var childData = dataRowView.CreateChildView(ds.Relations["BudgetRelation"]); |
| if (((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id != 0) |
| { |
| dv = new DataView(childData.ToTable(), "ActivityTypeID=" + ((ComboBoxValues.ComboValues)cmbActivityType.SelectedValue).Id, "", DataViewRowState.CurrentRows); |
| ((RadGridView)sender).DataContext = dv; |
| } |
| else |
| ((RadGridView)sender).DataContext = childData; |
| ((GridViewComboBoxColumn)((RadGridView)sender).Columns["ActivityTypeName"]).ItemsSource = ComboBoxValues.GetComboValues(dtActivityType); |
| } |