<Window.CommandBindings> |
<CommandBinding Command="NavigationCommands.GoToPage" Executed="GoToPageExecuteHandler" CanExecute="GoToPageCanExecuteHandler" /> |
</Window.CommandBindings> |
<Grid> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*" /> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto" /> |
<RowDefinition Height="*" /> |
</Grid.RowDefinitions> |
<Menu Name="menuemal" Grid.Column="0" Grid.Row="0"> |
<MenuItem Header="Page 1" Command="NavigationCommands.GoToPage" CommandParameter="Page/Page1.xaml" CommandTarget="{Binding ElementName=frmContent}" /> |
<MenuItem Header="Page 2" Command="NavigationCommands.GoToPage" CommandParameter="Page/Page2.xaml" CommandTarget="{Binding ElementName=frmContent}" /> |
<MenuItem Header="Page 3" Command="NavigationCommands.GoToPage" CommandParameter="Page/Page3.xaml" CommandTarget="{Binding ElementName=frmContent}" /> |
<MenuItem Header="Page without master" Command="NavigationCommands.GoToPage" CommandParameter="Page/PageWithoutMaster.xaml" CommandTarget="{Binding ElementName=frmContent}" /> |
</Menu> |
<Frame NavigationUIVisibility="Hidden" Name="frmContent" Grid.Column="0" Grid.Row="1" Source="Page/Page1.xaml" /> |
<telerik:RadTransitionControl Grid.Column="1" |
Content="{Binding SelectedItem, ElementName=frmContent}" Duration="00:00:03" > |
<telerik:RadTransitionControl.Transition> |
<telerikTransitions:MotionBlurredZoomTransition /> |
</telerik:RadTransitionControl.Transition> |
</telerik:RadTransitionControl> |
</Grid> |
<Grid>
<telerik:RadGridView Grid.Row="1" Grid.Column="0" AutoGenerateColumns="False" ShowGroupPanel="False" Name="grdPendingOrderDetail">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn></telerik:GridViewToggleRowDetailsColumn>
<telerik:GridViewDataColumn Header="Customer Codes" DataMemberBinding="{Binding CustomerCodes}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Created On" DataMemberBinding="{Binding CreatedOn}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Modified On" DataMemberBinding="{Binding ModifiedOn}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<Button Content="Resume" Click="Button_Click" Tag="{Binding CustomerCodes}"></Button>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<Grid>
<telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding PendingOrderCategories}" ShowGroupPanel="False" Name="grdPendingOrderCategory">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn></telerik:GridViewToggleRowDetailsColumn>
<telerik:GridViewDataColumn Header="Category Name" DataMemberBinding="{Binding CategoryName}" ></telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<Grid>
<telerik:RadGridView AutoGenerateColumns="False" IsFilteringAllowed="False" ShowGroupPanel="False" Name="grdPendingOrder" ItemsSource="{Binding PendingOrders}">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn></telerik:GridViewToggleRowDetailsColumn>
<telerik:GridViewSelectColumn IsGroupable="True" ></telerik:GridViewSelectColumn>
<telerik:GridViewDataColumn Header="Sales Order ID" DataMemberBinding="{Binding SalesOrderID}" ></telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<Grid>
<telerik:RadGridView AutoGenerateColumns="False" Name="grdOrderDetail" ItemsSource="{Binding OrderDetails}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Product Code" DataMemberBinding="{Binding ProductCode}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Customer Code" DataMemberBinding="{Binding CustomerCode}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Customer Name" DataMemberBinding="{Binding CustomerName}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Price" DataMemberBinding="{Binding Price}" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Quantity" DataMemberBinding="{Binding OrderQty}" ></telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>
</Grid>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>
</Grid>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>
</Grid>
private void Button_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
GridViewRow row = btn.ParentOfType<GridViewRow>(); //Row with CustomerName
RadGridView grd = row.ChildrenOfType<RadGridView>()[0]; //Grid with category name
GridViewDataControl grdVDC = grd as GridViewDataControl;
string salesOrderIDs = "";
foreach (GridViewRow rw in grdVDC.ChildrenOfType<GridViewRow>()) //foreach category name
{
RadGridView grdInner;
GridViewDataControl grdVDCInner;
if (!(rw is GridViewNewRow))
{
grdInner = rw.ChildrenOfType<RadGridView>()[0];
grdVDCInner = grdInner as GridViewDataControl;
foreach (GridViewRow rwInner in grdVDCInner.ChildrenOfType<GridViewRow>()) // foreach order in one category
{
if (!(rwInner is GridViewNewRow))
{
bool select = (bool)((System.Windows.Controls.CheckBox)rwInner.Cells[1].Content).IsChecked;
if (select)
{
salesOrderIDs += ((System.Windows.Controls.TextBlock)rwInner.Cells[2].Content).Text;
salesOrderIDs += ",";
break;
}
}
}
}
}
}
<
UserControl
x:Class
=
"SilverlightApplication1.MainPage"
xmlns:d
=
"http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable
=
"d"
d:DesignWidth
=
"640"
d:DesignHeight
=
"480"
xmlns:telerikGrid
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerikGrid:RadGridView
x:Name
=
"RadGridView1"
ItemsSource
=
"{Binding}"
AutoGenerateColumns
=
"False"
>
<
telerikGrid:RadGridView.ChildTableDefinitions
>
<
telerikGrid:GridViewTableDefinition
/>
</
telerikGrid:RadGridView.ChildTableDefinitions
>
<
telerikGrid:RadGridView.Columns
>
<
telerikGrid:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding ID}"
/>
<
telerikGrid:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
/>
</
telerikGrid:RadGridView.Columns
>
<
telerikGrid:RadGridView.HierarchyChildTemplate
>
<
DataTemplate
>
<
telerikGrid:RadGridView
x:Name
=
"SubGrid"
DataLoading
=
"SubGrid_DataLoading"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding Items}"
>
</
telerikGrid:RadGridView
>
</
DataTemplate
>
</
telerikGrid:RadGridView.HierarchyChildTemplate
>
</
telerikGrid:RadGridView
>
</
Grid
>
</
UserControl
>
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;
using
System.Windows.Data;
using
Telerik.Windows.Controls;
using
System.Collections.ObjectModel;
using
Telerik.Windows.Data;
using
Telerik.Windows.Controls.GridView;
namespace
SilverlightApplication1
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
DataContext = from i
in
Enumerable.Range(0, 10)
select
new
MyObject()
{
ID = i,
Name = String.Format(
"Name{0}"
, i)
};
}
public
class
MyObject
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
IEnumerable<MyObject2> Items
{
get
{
return
from i
in
Enumerable.Range(0, 10)
select
new
MyObject2()
{
x = i
};
}
}
}
public
class
MyObject2
{
public
int
x {
set
;
get
; }
public
IEnumerable<MyObject2> Items
{
get
{
return
from i
in
Enumerable.Range(0, 10)
select
new
MyObject2()
{
x = i
};
}
}
}
private
void
SubGrid_DataLoading(
object
sender, GridViewDataLoadingEventArgs e)
{
var grid = (GridViewDataControl)sender;
var d =
new
GridViewTableDefinition();
d.Relation =
new
PropertyRelation(
"Items"
);
grid.TableDefinition.ChildTableDefinitions.Add(d);
grid.AutoGenerateColumns =
false
;
grid.Columns.Add(
new
GridViewDataColumn() { DataMemberBinding =
new
Binding(
"x"
) });
}
}
}