Hello Team,
We are into the WPF application development. We are using the RadPivotGrid control to view the information grid. To view the same BI format we are saving the view(i.e in XML format). When we save the view. our application is saving the data in our database in XML format. Please review the attached file which is saved in xml format. But we want to know the what is the <ValueTypes> node which is created while saving the view. We want to know what is the version number saved in the file. Is there any relation with .net framework version while generating the XML string?
Below is the XML string.
<?xml version="1.0"?>
<RawData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SerializationString><?xml version="1.0" encoding="utf-16"?>
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<T>
<TI K="1984105613" N="Telerik.Pivot.Core.LocalDataSourceProvider, Telerik.Pivot.Core, Version=2014.2.729.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
</T>
<P>
<PV Key="1" TypeKey="-664072138">
<Value xsi:type="xsd:string">&lt;DataProviderSettings xmlns="http://schemas.datacontract.org/2004/07/AIMSDotNet" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;Aggregates xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;&lt;a:anyType i:type="b:PropertyAggregateDescription" xmlns:b="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core"&gt;&lt;b:CustomName i:nil="true"/&gt;&lt;b:TotalFormat i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Totals"/&gt;&lt;b:StringFormat i:nil="true"/&gt;&lt;b:StringFormatSelector i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Aggregates"/&gt;&lt;b:AggregateFunction i:type="b:SumAggregateFunction" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Aggregates"/&gt;&lt;b:PropertyName&gt;Stock&lt;/b:PropertyName&gt;&lt;/a:anyType&gt;&lt;/Aggregates&gt;&lt;AggregatesLevel&gt;0&lt;/AggregatesLevel&gt;&lt;AggregatesPosition&gt;Rows&lt;/AggregatesPosition&gt;&lt;Columns xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;&lt;a:anyType i:type="b:PropertyGroupDescription" xmlns:b="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core"&gt;&lt;b:CustomName i:nil="true"/&gt;&lt;b:GroupComparer i:type="b:GroupNameComparer"/&gt;&lt;b:SortOrder&gt;Ascending&lt;/b:SortOrder&gt;&lt;b:GroupFilter i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Filtering"/&gt;&lt;b:ShowGroupsWithNoData&gt;false&lt;/b:ShowGroupsWithNoData&gt;&lt;b:CalculatedItems/&gt;&lt;b:PropertyName&gt;WarehouseCode&lt;/b:PropertyName&gt;&lt;/a:anyType&gt;&lt;/Columns&gt;&lt;Filters xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/&gt;&lt;Rows xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;&lt;a:anyType i:type="b:PropertyGroupDescription" xmlns:b="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core"&gt;&lt;b:CustomName i:nil="true"/&gt;&lt;b:GroupComparer i:type="b:GroupNameComparer"/&gt;&lt;b:SortOrder&gt;Ascending&lt;/b:SortOrder&gt;&lt;b:GroupFilter i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Filtering"/&gt;&lt;b:ShowGroupsWithNoData&gt;false&lt;/b:ShowGroupsWithNoData&gt;&lt;b:CalculatedItems/&gt;&lt;b:PropertyName&gt;StyleDescription&lt;/b:PropertyName&gt;&lt;/a:anyType&gt;&lt;a:anyType i:type="b:PropertyGroupDescription" xmlns:b="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core"&gt;&lt;b:CustomName i:nil="true"/&gt;&lt;b:GroupComparer i:type="b:GroupNameComparer"/&gt;&lt;b:SortOrder&gt;Ascending&lt;/b:SortOrder&gt;&lt;b:GroupFilter i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Filtering"/&gt;&lt;b:ShowGroupsWithNoData&gt;false&lt;/b:ShowGroupsWithNoData&gt;&lt;b:CalculatedItems/&gt;&lt;b:PropertyName&gt;ColorDescription&lt;/b:PropertyName&gt;&lt;/a:anyType&gt;&lt;a:anyType i:type="b:PropertyGroupDescription" xmlns:b="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core"&gt;&lt;b:CustomName i:nil="true"/&gt;&lt;b:GroupComparer i:type="b:GroupNameComparer"/&gt;&lt;b:SortOrder&gt;Ascending&lt;/b:SortOrder&gt;&lt;b:GroupFilter i:nil="true" xmlns:c="http://schemas.datacontract.org/2004/07/Telerik.Pivot.Core.Filtering"/&gt;&lt;b:ShowGroupsWithNoData&gt;false&lt;/b:ShowGroupsWithNoData&gt;&lt;b:CalculatedItems/&gt;&lt;b:PropertyName&gt;Size&lt;/b:PropertyName&gt;&lt;/a:anyType&gt;&lt;/Rows&gt;&lt;/DataProviderSettings&gt;</Value>
</PV>
</P>
<R>
<RV Key="21184986" IsRoot="true" TypeKey="1984105613">
<D>
<PD PN="" VK="1" RK="0" TK="1984105613" TCK="0" />
</D>
</RV>
</R>
</Data></SerializationString>
<ValueTypes>
<string>Telerik.Pivot.Core.LocalDataSourceProvider, Telerik.Pivot.Core, Version=2014.2.729.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7</string>
</ValueTypes>
</RawData>
We want to know what is the significance of the version number(i.e Version=2014.2.729.45) in the below context?
<ValueTypes>
<string>Telerik.Pivot.Core.LocalDataSourceProvider, Telerik.Pivot.Core, Version=2014.2.729.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7</string>
</ValueTypes>
</RawData>
Following are the software specifications
OS: WINDOWS 10
.Net Framework: 4.6.2
Telerik Version: 14.2.729.0
Regards,
Chakradhar
<
Window
x:Class
=
"RadNumSandbox.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:RadNumSandbox"
Title
=
"MainWindow"
Height
=
"200"
Width
=
"200"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadNumericUpDown
x:Name
=
"radbox"
Grid.Row
=
"0"
Value
=
"{Binding Val, Mode=TwoWay}"
UpdateValueEvent
=
"LostFocus"
/>
</
Grid
>
</
Window
>
using
System.ComponentModel;
using
System.Diagnostics;
using
System.Windows;
namespace
RadNumSandbox
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
this
.DataContext =
this
;
InitializeComponent();
}
private
double
val = 1.1;
public
double
Val
{
get
{
return
val; }
set
{
if
(value != val)
{
val = value;
RaisePropertyChanged(
"Val"
);
Debug.Print(
string
.Format(
"Val = {0}"
, val ) );
}
}
}
#region INotifyPropertyChanged Members
public
event
PropertyChangedEventHandler PropertyChanged;
#endregion
#region Methods
private
void
RaisePropertyChanged(
string
propertyName )
{
// take a copy to prevent thread issues
PropertyChangedEventHandler handler = PropertyChanged;
if
(handler !=
null
)
{
handler(
this
,
new
PropertyChangedEventArgs( propertyName ) );
}
}
#endregion
}
}
Hi,
I'm facing issue that my ItemTemplateSelector doesn't work with my ItemContainerStyle.
If i comment out my ItemCOntainerStyle then ItemTemplateSelector works fine.
ItemContainerStyle which i'm using is as follows:
<
Style
x:Key
=
"SelectionStyle"
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
>
<
Setter
Property
=
"IsSelected"
Value
=
"{Binding IsSelected, Mode=TwoWay}"
/>
<
Setter
Property
=
"IsExpanded"
Value
=
"{Binding IsExpanded, Mode=TwoWay}"
/>
<
Setter
Property
=
"FocusVisualStyle"
>
<
Setter.Value
>
<
Style
>
<
Setter
Property
=
"Control.Template"
>
<
Setter.Value
>
<
ControlTemplate
>
<
Rectangle
Margin
=
"0"
Stroke
=
"Transparent"
StrokeThickness
=
"0"
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"CheckState"
Value
=
"Off"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"1"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
>
<
Grid
x:Name
=
"RootElement"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
Grid
x:Name
=
"HeaderRow"
Background
=
"Transparent"
MinHeight
=
"{TemplateBinding MinHeight}"
SnapsToDevicePixels
=
"True"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Border
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"{TemplateBinding Background}"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"2"
/>
<
Border
x:Name
=
"MouseOverVisual"
BorderBrush
=
"White"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"1"
Opacity
=
"0"
>
<
Border
BorderBrush
=
"#CCE6FF"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#CCE6FF"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#CCE6FF"
Offset
=
"0"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
Border
x:Name
=
"SelectionUnfocusedVisual"
BorderBrush
=
"#B3DAFF"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"1"
Visibility
=
"Collapsed"
>
<
Border
BorderBrush
=
"#B3DAFF"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<!--<
LinearGradientBrush
EndPoint
=
"0,1"
>
<
GradientStop
Color
=
"#FFF8F6F9"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FFF0F0F0"
Offset
=
"1"
/>
</
LinearGradientBrush
>-->
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#B3DAFF"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#B3DAFF"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
Border
x:Name
=
"SelectionVisual"
BorderBrush
=
"#80C1FF"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"5"
Grid.Column
=
"3"
CornerRadius
=
"1"
Visibility
=
"Collapsed"
>
<
Border
BorderBrush
=
"#80C1FF"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#80C1FF"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#80C1FF"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
StackPanel
x:Name
=
"IndentContainer"
Orientation
=
"Horizontal"
>
<
Rectangle
x:Name
=
"IndentFirstVerticalLine"
Stroke
=
"#FFCCCCCC"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Top"
Width
=
"1"
/>
</
StackPanel
>
<
Grid
x:Name
=
"ListRootContainer"
Grid.Column
=
"1"
HorizontalAlignment
=
"Center"
MinWidth
=
"20"
>
<
Rectangle
x:Name
=
"HorizontalLine"
HorizontalAlignment
=
"Right"
Height
=
"1"
Stroke
=
"#FFCCCCCC"
VerticalAlignment
=
"Center"
/>
<
Rectangle
x:Name
=
"VerticalLine"
HorizontalAlignment
=
"Center"
Stroke
=
"#FFCCCCCC"
VerticalAlignment
=
"Top"
Width
=
"1"
/>
<
ToggleButton
x:Name
=
"Expander"
Background
=
"{TemplateBinding Background}"
IsTabStop
=
"False"
/>
<
Grid
x:Name
=
"LoadingVisual"
HorizontalAlignment
=
"Center"
RenderTransformOrigin
=
"0.5,0.5"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
Grid.RenderTransform
>
<
TransformGroup
>
<
RotateTransform
Angle
=
"0"
CenterY
=
"0.5"
CenterX
=
"0.5"
/>
</
TransformGroup
>
</
Grid.RenderTransform
>
<
Path
Data
=
"M1,0A1,1,90,1,1,0,-1"
Height
=
"10"
StrokeStartLineCap
=
"Round"
Stretch
=
"Fill"
Stroke
=
"{TemplateBinding Foreground}"
StrokeThickness
=
"1"
Width
=
"10"
/>
<
Path
Data
=
"M0,-1.1L0.1,-1 0,-0.9"
Fill
=
"{TemplateBinding Foreground}"
HorizontalAlignment
=
"Left"
Height
=
"4"
Margin
=
"5,-1.5,0,0"
Stretch
=
"Fill"
StrokeThickness
=
"1"
VerticalAlignment
=
"Top"
Width
=
"4"
/>
</
Grid
>
</
Grid
>
<
CheckBox
x:Name
=
"CheckBoxElement"
IsEnabled
=
"{Binding HasChildren, Mode=OneWay}"
Grid.Column
=
"2"
IsTabStop
=
"False"
Margin
=
"5,0,0,0"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
telerik:StyleManager.Theme
>
<
telerik:Office_BlackTheme
/>
</
telerik:StyleManager.Theme
>
</
CheckBox
>
<
RadioButton
x:Name
=
"RadioButtonElement"
Grid.Column
=
"2"
IsTabStop
=
"False"
Margin
=
"5,0,0,0"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
telerik:StyleManager.Theme
>
<
telerik:Office_BlackTheme
/>
</
telerik:StyleManager.Theme
>
</
RadioButton
>
<
Image
x:Name
=
"Image"
Grid.Column
=
"3"
HorizontalAlignment
=
"Center"
MaxWidth
=
"16"
MaxHeight
=
"16"
Margin
=
"2"
VerticalAlignment
=
"Center"
/>
<
Rectangle
x:Name
=
"FocusVisual"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
IsHitTestVisible
=
"False"
RadiusY
=
"3"
RadiusX
=
"3"
Stroke
=
"Black"
StrokeThickness
=
"1"
StrokeDashArray
=
"1 2"
Visibility
=
"Collapsed"
/>
<
Grid
Grid.ColumnSpan
=
"2"
Grid.Column
=
"4"
>
<
ContentPresenter
x:Name
=
"Header"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
Content
=
"{TemplateBinding Header}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
<
ContentPresenter
x:Name
=
"EditHeaderElement"
ContentTemplate
=
"{TemplateBinding HeaderEditTemplate}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
Visibility
=
"Collapsed"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
</
Grid
>
</
Grid
>
<
ItemsPresenter
x:Name
=
"ItemsHost"
Grid.Row
=
"1"
Visibility
=
"Collapsed"
/>
</
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
=
"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
=
"0"
/>
<
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
=
"IsLoadingOnDemand"
Value
=
"True"
>
<
Trigger.EnterActions
>
<
BeginStoryboard
x:Name
=
"LoadingVisualTransform"
>
<
Storyboard
>
<
DoubleAnimation
Duration
=
"0:0:1"
From
=
"0"
RepeatBehavior
=
"Forever"
To
=
"359"
Storyboard.TargetProperty
=
"Angle"
Storyboard.TargetName
=
"LoadingVisualAngleTransform"
/>
</
Storyboard
>
</
BeginStoryboard
>
</
Trigger.EnterActions
>
<
Trigger.ExitActions
>
<
StopStoryboard
BeginStoryboardName
=
"LoadingVisualTransform"
/>
</
Trigger.ExitActions
>
<
Setter
Property
=
"Visibility"
TargetName
=
"LoadingVisual"
Value
=
"Visible"
/>
<
Setter
Property
=
"Visibility"
TargetName
=
"Expander"
Value
=
"Collapsed"
/>
</
Trigger
>
<
Trigger
Property
=
"IsDragOver"
Value
=
"True"
>
<
Setter
Property
=
"Opacity"
TargetName
=
"MouseOverVisual"
Value
=
"1"
/>
</
Trigger
>
<
MultiTrigger
>
<
MultiTrigger.Conditions
>
<
Condition
Property
=
"IsMouseOver"
SourceName
=
"HeaderRow"
Value
=
"True"
/>
<
Condition
Property
=
"IsEnabled"
SourceName
=
"CheckBoxElement"
Value
=
"True"
/>
</
MultiTrigger.Conditions
>
<
Setter
Property
=
"Opacity"
TargetName
=
"MouseOverVisual"
Value
=
"1"
/>
</
MultiTrigger
>
</
ControlTemplate.Triggers
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"ItemsPanel"
>
<
Setter.Value
>
<
ItemsPanelTemplate
>
<
telerik:TreeViewPanel
IsItemsHost
=
"True"
IsVisualCacheEnabled
=
"False"
VerticalAlignment
=
"Bottom"
/>
</
ItemsPanelTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
Kindly let me know what is the issue in my ItemContainerStyle.
Regards,
Tayyaba
Hi Telerik,
I am doing some validations when I insert new row and editing the details of the row.I am using SelectedItem to do validations in background.So I want to make the new row as selectedItem once it is inserted after clicking on the button "Click here to add new Item".Is there any way to make selecteditem the newly created row through xaml?
Regards,
Nagasree.
Hi,
How can I export a hierarchical grid to Excel so that we don't get security warnings? From GridView documentation and this forum it looks like hierarchical grids can only be exported as HTML or CSV, which doesn't fit our requirements. Could you confirm that it is not possible to export nested grids as xslx? What is the best approach - make custom export all together, or use Telerik API?
Thanks
Alex
I am using a RadScheduleView (version 2018.1.116) with the MonthViewDefinition. My users want to be able to select multiple appointments spanning across several months. It appears the RadScheduleView only allows selecting appointments within the current VisibleRange. For instance, if I select a set of appointments in the current month (such as Feb 8-Feb 10), then navigate to another month and hold Ctrl or Shift while selecting another appointment (such as Jan 5), the previously selected appointments are lost, and only the appointment in the visible month remains selected (i.e. only Jan 5 is selected, Feb 8-Feb 10 are no longer selected).
I can select my full appointment range via code-behind (spanning multiple months), but is there a way I can enable this behavior for my users? I assume this would involve a custom AppointmentSelectionBehavior, but looking at the source code it appears the AppointmentSelectionHelper (an internal class) is what's limiting my selection to the VisibleRange.
public
class
Container : INotifyPropertyChanged
{
public
Container()
{
Children =
new
ObservableCollection<
object
>();
}
// Public properties
public
ObservableCollection<
object
> Children {
get
;
private
set
; }
private
string
_displayName;
public
string
DisplayName
{
get
{
return
_displayName; }
set
{
_displayName = value;
OnPropertyChanged(
"DisplayName"
);
}
}
// INotifyPropertyChanged members
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
OnPropertyChanged(
string
propertyName)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
}
public
class
Item : INotifyPropertyChanged
{
// Public properties
private
string
_displayName;
public
string
DisplayName
{
get
{
return
_displayName; }
set
{
_displayName = value;
OnPropertyChanged(
"DisplayName"
);
}
}
// INotifyPropertyChanged members
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
OnPropertyChanged(
string
propertyName)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
}
public
partial
class
MainWindow
{
// Constructors
public
MainWindow()
{
InitializeComponent();
CreateDummyData();
DataContext =
this
;
}
// Public properties
public
ObservableCollection<
object
> Items {
get
;
private
set
; }
// Private methdods
private
void
CreateDummyData()
{
Items =
new
ObservableCollection<
object
>();
// level 0
var i1 =
new
Item { DisplayName =
"Item 1"
};
Items.Add(i1);
var i2 =
new
Item { DisplayName =
"Item 2"
};
Items.Add(i2);
var c1 =
new
Container { DisplayName =
"Container 1"
};
Items.Add(c1);
var c2 =
new
Container { DisplayName =
"Container 2"
};
Items.Add(c2);
var i8 =
new
Item { DisplayName =
"Item 8"
};
Items.Add(i8);
var c3 =
new
Container { DisplayName =
"Container 3"
};
Items.Add(c3);
var i11 =
new
Item { DisplayName =
"Item 11"
};
Items.Add(i11);
// Level 1.0
var c1S1 =
new
Container { DisplayName =
"Subcontainer 1"
};
c1.Children.Add(c1S1);
var c1S2 =
new
Container { DisplayName =
"Subcontainer 2"
};
c1.Children.Add(c1S2);
var i3 =
new
Item { DisplayName =
"Item 3"
};
c1.Children.Add(i3);
var i4 =
new
Item { DisplayName =
"Item 4"
};
c1.Children.Add(i4);
var i12 =
new
Item { DisplayName =
"Item 12"
};
c1.Children.Add(i12);
// Level 1.0.0
var c1S1S1 =
new
Container { DisplayName =
"Subsubcontainer 1"
};
c1S1.Children.Add(c1S1S1);
var i5 =
new
Item { DisplayName =
"Item 5"
};
c1S1.Children.Add(i5);
var i6 =
new
Item { DisplayName =
"Item 6"
};
c1S1.Children.Add(i6);
var i7 =
new
Item { DisplayName =
"Item 7"
};
c1S1S1.Children.Add(i7);
// Level 1.0.1
var i15 =
new
Item { DisplayName =
"Item 15"
};
c1S2.Children.Add(i15);
var i16 =
new
Item { DisplayName =
"Item 16"
};
c1S2.Children.Add(i16);
var i17 =
new
Item { DisplayName =
"Item 17"
};
c1S2.Children.Add(i17);
// Level 1.0.0.0
var i13 =
new
Item { DisplayName =
"Item 13"
};
c1S1S1.Children.Add(i13);
var i14 =
new
Item { DisplayName =
"Item 14"
};
c1S1S1.Children.Add(i14);
// Level 3.0
var i9 =
new
Item { DisplayName =
"Item 9"
};
c3.Children.Add(i9);
var i10 =
new
Item { DisplayName =
"Item 10"
};
c3.Children.Add(i10);
}
}
public
class
MyDataTemplateSelector : DataTemplateSelector
{
public
HierarchicalDataTemplate ContainerTemplate {
get
;
set
; }
public
DataTemplate ItemTemplate {
get
;
set
; }
public
override
DataTemplate SelectTemplate(
object
item, DependencyObject container)
{
if
(item
is
Item)
{
return
ItemTemplate;
}
return
ContainerTemplate;
}
}
<
Window
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:TreeViewTest
=
"clr-namespace:TreeViewTest"
xmlns:System_Windows_Automation
=
"clr-namespace:System.Windows.Automation;assembly=UIAutomationTypes"
x:Class
=
"TreeViewTest.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
HierarchicalDataTemplate
x:Key
=
"ContainerTemplate"
ItemsSource
=
"{Binding Children}"
>
<
TextBlock
Text
=
"{Binding DisplayName}"
Background
=
"Red"
/>
</
HierarchicalDataTemplate
>
<
DataTemplate
x:Key
=
"ItemTemplate"
>
<
TextBlock
Text
=
"{Binding DisplayName}"
Background
=
"Green"
/>
</
DataTemplate
>
<
TreeViewTest:MyDataTemplateSelector
x:Key
=
"MyDataTemplateSelector"
ContainerTemplate
=
"{StaticResource ContainerTemplate}"
ItemTemplate
=
"{StaticResource ItemTemplate}"
/>
<
Style
x:Key
=
"RadTreeViewItemStyle"
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
>
<
Setter
Property
=
"FocusVisualStyle"
>
<
Setter.Value
>
<
Style
>
<
Setter
Property
=
"Control.Template"
>
<
Setter.Value
>
<
ControlTemplate
>
<
Rectangle
Margin
=
"0"
Stroke
=
"Transparent"
StrokeThickness
=
"0"
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Left"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Center"
/>
<!--<
Setter
>
<
Setter.Value
>
<
System_Windows_Automation:ToggleState
>Off</
System_Windows_Automation:ToggleState
>
</
Setter.Value
>
</
Setter
>-->
<!--causes exception-->
<
Setter
Property
=
"BorderThickness"
Value
=
"1"
/>
<
Setter
Property
=
"Padding"
Value
=
"1,0,5,0"
/>
<
Setter
Property
=
"IsDropAllowed"
Value
=
"True"
/>
<
Setter
Property
=
"ItemsOptionListType"
Value
=
"Default"
/>
<
Setter
Property
=
"IsEnabled"
Value
=
"True"
/>
<
Setter
Property
=
"MinHeight"
Value
=
"24"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
>
<
Grid
x:Name
=
"RootElement"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"EditStates"
>
<
VisualState
x:Name
=
"Display"
/>
<
VisualState
x:Name
=
"Edit"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"EditHeaderElement"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Header"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"CommonStates"
>
<
VisualState
x:Name
=
"Normal"
/>
<
VisualState
x:Name
=
"Disabled"
>
<
Storyboard
>
<
DoubleAnimation
Duration
=
"0"
To
=
"0.35"
Storyboard.TargetProperty
=
"Opacity"
Storyboard.TargetName
=
"Header"
/>
<
DoubleAnimation
Duration
=
"0"
To
=
"0.35"
Storyboard.TargetProperty
=
"Opacity"
Storyboard.TargetName
=
"Image"
/>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"MouseOver"
>
<
Storyboard
>
<
DoubleAnimation
Duration
=
"0:0:0.1"
To
=
"1"
Storyboard.TargetProperty
=
"Opacity"
Storyboard.TargetName
=
"MouseOverVisual"
/>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"SelectionStates"
>
<
VisualState
x:Name
=
"Unselected"
/>
<
VisualState
x:Name
=
"Selected"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"SelectionVisual"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"SelectedUnfocused"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"SelectionUnfocusedVisual"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"LoadingOnDemandStates"
>
<
VisualState
x:Name
=
"LoadingOnDemand"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"LoadingVisual"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"Expander"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
DoubleAnimation
Duration
=
"0:0:1"
From
=
"0"
RepeatBehavior
=
"Forever"
To
=
"359"
Storyboard.TargetProperty
=
"Angle"
Storyboard.TargetName
=
"LoadingVisualAngleTransform"
/>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"LoadingOnDemandReverse"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"FocusStates"
>
<
VisualState
x:Name
=
"Focused"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"FocusVisual"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Unfocused"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"ExpandStates"
>
<
VisualState
x:Name
=
"Expanded"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetProperty
=
"Visibility"
Storyboard.TargetName
=
"ItemsHost"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Collapsed"
/>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Grid
x:Name
=
"HeaderRow"
Background
=
"Transparent"
MinHeight
=
"{TemplateBinding MinHeight}"
SnapsToDevicePixels
=
"True"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Border
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"{TemplateBinding Background}"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"2"
/>
<
Border
x:Name
=
"MouseOverVisual"
BorderBrush
=
"#FFFFC92B"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"1"
Opacity
=
"0"
>
<
Border
BorderBrush
=
"White"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#FFFFFBA3"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FFFFFBDA"
Offset
=
"0"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
Border
x:Name
=
"SelectionUnfocusedVisual"
BorderBrush
=
"#FFDBDBDB"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"1"
Visibility
=
"Collapsed"
>
<
Border
BorderBrush
=
"Transparent"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0,1"
>
<
GradientStop
Color
=
"#FFF8F6F9"
Offset
=
"0"
/>
<
GradientStop
Color
=
"#FFF0F0F0"
Offset
=
"1"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
Border
x:Name
=
"SelectionVisual"
BorderBrush
=
"#FFFFC92B"
BorderThickness
=
"1"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
CornerRadius
=
"1"
Visibility
=
"Collapsed"
>
<
Border
BorderBrush
=
"White"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
Border.Background
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#FFFCE79F"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FFFDD3A8"
/>
</
LinearGradientBrush
>
</
Border.Background
>
</
Border
>
</
Border
>
<
StackPanel
x:Name
=
"IndentContainer"
Orientation
=
"Horizontal"
>
<
Rectangle
x:Name
=
"IndentFirstVerticalLine"
Stroke
=
"#FFCCCCCC"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Top"
Width
=
"1"
/>
</
StackPanel
>
<
Grid
x:Name
=
"ListRootContainer"
Grid.Column
=
"1"
HorizontalAlignment
=
"Center"
MinWidth
=
"20"
>
<
Rectangle
x:Name
=
"HorizontalLine"
HorizontalAlignment
=
"Right"
Height
=
"1"
Stroke
=
"#FFCCCCCC"
VerticalAlignment
=
"Center"
/>
<
Rectangle
x:Name
=
"VerticalLine"
HorizontalAlignment
=
"Center"
Stroke
=
"#FFCCCCCC"
VerticalAlignment
=
"Top"
Width
=
"1"
/>
<
ToggleButton
x:Name
=
"Expander"
Background
=
"{TemplateBinding Background}"
IsTabStop
=
"False"
/>
<
Grid
x:Name
=
"LoadingVisual"
HorizontalAlignment
=
"Center"
RenderTransformOrigin
=
"0.5,0.5"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
Grid.RenderTransform
>
<
TransformGroup
>
<
RotateTransform
Angle
=
"0"
CenterY
=
"0.5"
CenterX
=
"0.5"
/>
</
TransformGroup
>
</
Grid.RenderTransform
>
<
Path
Data
=
"M1,0A1,1,90,1,1,0,-1"
Height
=
"10"
StrokeStartLineCap
=
"Round"
Stretch
=
"Fill"
Stroke
=
"{TemplateBinding Foreground}"
StrokeThickness
=
"1"
Width
=
"10"
/>
<
Path
Data
=
"M0,-1.1L0.1,-1 0,-0.9"
Fill
=
"{TemplateBinding Foreground}"
HorizontalAlignment
=
"Left"
Height
=
"4"
Margin
=
"5,-1.5,0,0"
Stretch
=
"Fill"
StrokeThickness
=
"1"
VerticalAlignment
=
"Top"
Width
=
"4"
/>
</
Grid
>
</
Grid
>
<
CheckBox
x:Name
=
"CheckBoxElement"
Grid.Column
=
"2"
IsTabStop
=
"False"
Margin
=
"5,0,0,0"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
telerik:StyleManager.Theme
>
<
telerik:Office_BlackTheme
/>
</
telerik:StyleManager.Theme
>
</
CheckBox
>
<
RadioButton
x:Name
=
"RadioButtonElement"
Grid.Column
=
"2"
IsTabStop
=
"False"
Margin
=
"5,0,0,0"
Visibility
=
"Collapsed"
VerticalAlignment
=
"Center"
>
<
telerik:StyleManager.Theme
>
<
telerik:Office_BlackTheme
/>
</
telerik:StyleManager.Theme
>
</
RadioButton
>
<
Image
x:Name
=
"Image"
Grid.Column
=
"3"
HorizontalAlignment
=
"Center"
MaxWidth
=
"16"
MaxHeight
=
"16"
Margin
=
"2"
VerticalAlignment
=
"Center"
/>
<
Rectangle
x:Name
=
"FocusVisual"
Grid.ColumnSpan
=
"6"
Grid.Column
=
"2"
IsHitTestVisible
=
"False"
RadiusY
=
"3"
RadiusX
=
"3"
Stroke
=
"Black"
StrokeThickness
=
"1"
StrokeDashArray
=
"1 2"
Visibility
=
"Collapsed"
/>
<
Grid
Grid.ColumnSpan
=
"2"
Grid.Column
=
"4"
>
<
ContentPresenter
x:Name
=
"Header"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
Content
=
"{TemplateBinding Header}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
<
ContentPresenter
x:Name
=
"EditHeaderElement"
ContentTemplate
=
"{TemplateBinding HeaderEditTemplate}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
Visibility
=
"Collapsed"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
</
Grid
>
</
Grid
>
<
ItemsPresenter
x:Name
=
"ItemsHost"
Grid.Row
=
"1"
Visibility
=
"Collapsed"
/>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"ItemsPanel"
>
<
Setter.Value
>
<
ItemsPanelTemplate
>
<
telerik:TreeViewPanel
IsItemsHost
=
"True"
IsVisualCacheEnabled
=
"False"
VerticalAlignment
=
"Bottom"
/>
</
ItemsPanelTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Window.Resources
>
<
Grid
>
<
telerik:RadTreeView
ItemsSource
=
"{Binding Items}"
ItemTemplateSelector
=
"{StaticResource MyDataTemplateSelector}"
ItemContainerStyle
=
"{DynamicResource RadTreeViewItemStyle}"
/>
</
Grid
>
</
Window
>
Hello,
Using components from UI for WPF R2 2017 ... It appears that RadGridView column virtualization is causing some binding errors, which in turn seem to place the GridView in a state where column header bindings fail when those columns are not rendered initially due to virtualization. For example, the sample below works if EnableColumnVirtualization is set to false, or if the window size is large enough such that all columns are rendered (such as 800 in the example below).
With the Office2016 theme, I'm getting two types of binding errors:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadGridView', AncestorLevel='1''. BindingExpression:Path=DataContext.HeaderText; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.GridView.DataCellsPresenter', AncestorLevel='1''. BindingExpression:Path=Foreground; DataItem=null; target element is 'ContentControl' (Name='PART_ContentPresenter'); target property is 'Foreground' (type 'Brush')
(The sample has a single row in the ItemsSource ... real world situations would produce dozens+ of the errors looking for DataCellsPresenter.)
Other themes I've tested just produce the first binding error.
Here's the .xaml:
<
Window
x:Class
=
"TelerikWpfApp.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"300"
Width
=
"400"
>
<
Grid
>
<
telerik:RadGridView
EnableColumnVirtualization
=
"True"
AutoGenerateColumns
=
"False"
GroupRenderMode
=
"Flat"
ItemsSource
=
"{Binding TestObjects}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 1 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 2 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 3 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 4 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 5 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
Header
=
"Column 6 Name"
DataMemberBinding
=
"{Binding Column1}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Column1}"
>
<
telerik:GridViewDataColumn.Header
>
<
TextBlock
Text
=
"{Binding DataContext.HeaderText, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
/>
</
telerik:GridViewDataColumn.Header
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
Window
>
And here's the code:
using
System.Collections.Generic;
using
System.Windows;
using
Telerik.Windows.Controls;
namespace
TelerikWpfApp
{
public
partial
class
MainWindow : Window
{
public
class
TestObject
{
public
string
Name {
get
;
set
; }
public
string
Column1 {
get
;
set
; }
}
public
MainWindow()
{
StyleManager.ApplicationTheme =
new
Office2016Theme();
InitializeComponent();
this
.DataContext =
this
;
TestObjects =
new
List<TestObject>
{
new
TestObject { Name =
"1"
, Column1 =
"Column1"
}
};
}
public
List<TestObject> TestObjects {
get
;
set
; }
public
string
HeaderText {
get
{
return
"Test"
; } }
}
}
Any assistance would be appreciated.