or
<
UserControl
x:Class
=
"SpdrRiskDetail.SpdrRiskDetailControl"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:pivot
=
"http://schemas.telerik.com/2008/xaml/presentation/pivot"
xmlns:data
=
"clr-namespace:SpdrRiskDetail"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"300"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"3*"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
pivot:RadPivotGrid
x:Name
=
"mainPivotGrid"
Grid.RowSpan
=
"2"
/>
<
pivot:RadPivotFieldList
x:Name
=
"mainFieldList"
Grid.Column
=
"1"
Margin
=
"4 0 0 0"
/>
</
Grid
>
</
UserControl
>
gridView.Rows[1].Childrens (type IEnumerable<GridViewRow>)
using
System;
using
System.Collections.Generic;
using
System.Collections.ObjectModel;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Data;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Imaging;
using
System.Windows.Navigation;
using
System.Windows.Shapes;
namespace
TelerikPropertyGrid
{
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
PropertiesObject property1 =
new
PropertiesObject() { PropertyName =
"stringProperty1"
, PropertyType =
typeof
(
string
), PropertyValue=
"string 1"
};
PropertiesObject property2 =
new
PropertiesObject() { PropertyName =
"stringProperty2"
, PropertyType =
typeof
(
string
), PropertyValue =
"string 2"
};
PropertiesObject property3 =
new
PropertiesObject() { PropertyName =
"boolProperty1"
, PropertyType =
typeof
(
bool
), PropertyValue= (Boolean)
true
};
PropertiesObject property4 =
new
PropertiesObject() { PropertyName =
"boolProperty2"
, PropertyType =
typeof
(
bool
), PropertyValue = (Boolean)
false
};
PropertiesObject property5 =
new
PropertiesObject() { PropertyName =
"intProperty1"
, PropertyType =
typeof
(
int
), PropertyValue=(Int32)10 };
ObservableCollection<PropertiesObject> properties =
new
ObservableCollection<PropertiesObject>() { property1, property2, property3, property4, property5 };
MainObject main =
new
MainObject() { Name =
"john"
, Age = 25, OtherProperties = properties };
//this is the property grid I have and want to modify using only MainObject and PropertiesObject classes
PropertyGrid1.Item = main;
PropertyGrid1.Visibility = System.Windows.Visibility.Visible;
//this proeprty grid demonstrates how I want my grid to look like.
//I created the "goal*" classes in order to populate it, I don't have those in the production system
PropertyGrid2.Item =
new
GoalDisplayObject();
PropertyGrid2.Visibility = System.Windows.Visibility.Hidden;
}
}
public
class
MainObject
//exist in production
{
public
string
Name {
get
;
set
; }
public
int
Age {
get
;
set
; }
public
ObservableCollection<PropertiesObject> OtherProperties {
get
;
set
; }
}
public
class
PropertiesObject
//exist in production
{
public
string
PropertyName {
get
;
set
; }
public
Type PropertyType {
get
;
set
; }
public
object
PropertyValue {
get
;
set
; }
}
public
class
GoalDisplayObject
//doesn't exist in production
{
public
string
Name {
get
{
return
"john"
; }
set
{ } }
public
int
Age {
get
{
return
25; }
set
{ } }
public
GoalNestedProperties OtherProperties {
get
{
return
new
GoalNestedProperties(); }
set
{ } }
}
public
class
GoalNestedProperties
//doesn't exist in production
{
public
bool
boolProperty1 {
get
{
return
true
; }
set
{ } }
public
bool
boolProperty2 {
get
{
return
false
; }
set
{ } }
public
string
stringProperty1 {
get
{
return
"string 1"
; }
set
{ } }
public
string
stringProperty2 {
get
{
return
"string 2"
; }
set
{ } }
public
int
intProperty1 {
get
{
return
10; }
set
{ } }
public
override
string
ToString() {
return
""
; }
}
}
<
Window
x:Class
=
"TelerikPropertyGrid.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:TelerikPropertyGrid"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadPropertyGrid
x:Name
=
"PropertyGrid1"
Grid.Row
=
"0"
NestedPropertiesVisibility
=
"Visible"
SortAndGroupButtonsVisibility
=
"Collapsed"
SearchBoxVisibility
=
"Collapsed"
FieldIndicatorVisibility
=
"Collapsed"
DescriptionPanelVisibility
=
"Collapsed"
/>
<
telerik:RadPropertyGrid
x:Name
=
"PropertyGrid2"
Grid.Row
=
"0"
AutoGeneratePropertyDefinitions
=
"False"
NestedPropertiesVisibility
=
"Visible"
SortAndGroupButtonsVisibility
=
"Collapsed"
SearchBoxVisibility
=
"Collapsed"
FieldIndicatorVisibility
=
"Collapsed"
DescriptionPanelVisibility
=
"Collapsed"
>
<
telerik:RadPropertyGrid.PropertyDefinitions
>
<
telerik:PropertyDefinition
Binding
=
"{Binding Name}"
DisplayName
=
"Name"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding Age}"
DisplayName
=
"Age"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding OtherProperties}"
DisplayName
=
"Other Properties"
IsExpanded
=
"True"
>
<
telerik:PropertyDefinition.NestedProperties
>
<
telerik:PropertyDefinition
Binding
=
"{Binding boolProperty1}"
DisplayName
=
"boolProperty1"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding boolProperty2}"
DisplayName
=
"boolProperty2"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding stringProperty1}"
DisplayName
=
"stringProperty1"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding stringProperty2}"
DisplayName
=
"stringProperty2"
/>
<
telerik:PropertyDefinition
Binding
=
"{Binding intProperty1}"
DisplayName
=
"intProperty1"
/>
</
telerik:PropertyDefinition.NestedProperties
>
</
telerik:PropertyDefinition
>
</
telerik:RadPropertyGrid.PropertyDefinitions
>
</
telerik:RadPropertyGrid
>
</
Grid
>
</
Window
>