How can I remove the expand icon where there is no data in the child
this is my code
this is my code
<telerik:RadGridView Margin="15,5,15,5" Name="gvRequest" Height="auto" Width="Auto" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
telerik:StyleManager.Theme="Simple" AutoGenerateColumns="False" |
IsFilteringAllowed="False" FlowDirection="RightToLeft" ShowGroupPanel="False"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn UniqueName="ActivityName" Header="שם תת פעילות" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="RequestID" Header="מספר דרישה" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="RequestName" Header="שם דרישה" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="RequestTotal" Header="סכום הדרישה (K ש''ח)" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="RequestType" Header="סוג הדרישה" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="Supplier" Header="ספק" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="RequestBalance" Header="יתרה בדרישה (K ש''ח)" Width="Auto" /> |
</telerik:RadGridView.Columns> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<StackPanel DataContext="{x:Null}"> |
<telerik:RadGridView CanUserReorderColumns="False" Name="gvOrder" |
CanUserFreezeColumns="False" ShowGroupPanel="False" ColumnsWidthMode="Auto" AutoGenerateColumns="False" ItemsSource="{Binding}" |
Loaded="OnChildGridLoaded" FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="True" ColumnBackground="AliceBlue" HorizontalContentAlignment="Right" ClipToBounds="True"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn UniqueName="OrderID" Header="מספר הזמנה" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="OrderName" Header="שם הזמנה" Width="Auto" /> |
<telerik:GridViewDataColumn UniqueName="OrderTotal" Header="סכום הזמנה (K ש''ח)" Width="Auto" /> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
</StackPanel> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
private void BindDataMainGrid() |
{ |
try |
{ |
DataSet dataSet = this.GetData(); |
// This is needed to make the grid use the HierarchyChildTemplate |
GridViewTableDefinition detailDefinition = new GridViewTableDefinition(); |
// Tell the detailsDefinition to pull its data from the Details DataTable. |
detailDefinition.DataSource = dataSet.Tables["Order"].DefaultView; |
// Specify the relation between the two tables, similar to what is done in the DataSet. |
TableRelation tr = new TableRelation(); |
tr.FieldNames.Add(new FieldDescriptorNamePair("RequestID", "RequestID")); |
detailDefinition.Relation = tr; |
// Add a GridViewTableDefinition to the grid to make it use the HierarchyChildTemplate |
// defined in XAML. |
if (this.gvRequest.TableDefinition.ChildTableDefinitions.Count < 1) |
this.gvRequest.TableDefinition.ChildTableDefinitions.Add(detailDefinition); |
// Bind the grid to the "master" table. |
this.gvRequest.ItemsSource = dataSet.Tables["Request"].DefaultView; |
} |
catch |
{ |
this.gvRequest.ItemsSource = CommonValues.GetDataTabel().DefaultView; |
} |
} |
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["RequestID"]); |
// Manually set the DataContext of the child grid. |
// We have stopped a wrong DataContext propagating down to this child grid |
// in the XAML file by wrapping the child grid in a StackPanel and setting |
// the StackPanel's DataContext to null. |
((RadGridView)sender).DataContext = childData; |
} |
private DataSet GetData() |
{ |
try |
{ |
DataSet ds = new DataSet(); |
dsRequest dsr = ServiceData.GetRequestAndOrder(0,0,1,2009,0); |
ds.Tables.Add(dsr.Tables["Request"].Copy()); |
ds.Tables.Add(dsr.Tables["Order"].Copy()); |
ds.Relations.Add("RequestID", |
ds.Tables["Request"].Columns["RequestID"], |
ds.Tables["Order"].Columns["RequestID"]); |
return ds; |
} |
catch |
{ |
return null; |
} |
} |
Thanks