Would it be possible to set the column definitions for a RadDataGrid from a XAML style or ContentPresenter?
I have created a datagrid with a datapager, number of results dropdown, and group, and filter translation to an rpc-database backend.
I would now like to put all these components in a custom usercontrol, which has my IRpcViewModel of various database models as datacontext.
This way I'm hoping to use the same xaml/codebase for the datagrid presentation of different models.
Basically I'd like to have an implementation for the following in pseudo code:
<
MyRpcDataGrid
ItemsSource
=
"{Binding ItemList}"
>
<
grid:DataGridTextColumn
PropertyName
=
"PurOrdNr"
Header
=
"Order"
CanUserEdit
=
"False"
/>
<
grid:DataGridTextColumn
PropertyName
=
"Description"
Header
=
"Description"
/>
<
grid:DataGridNumericalColumn
PropertyName
=
"PartCode"
Header
=
"Artikel"
/>
</
MyRpcDataGrid
>
With something like this as UserControl:
<
UserControl
x:Class
=
"MyApp.MyRpcDataGrid"
xmlns:grid
=
"using:Telerik.UI.Xaml.Controls.Grid"
>
<
UserControl.Content
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
grid:RadDataGrid
Grid.Row
=
"0"
x:Name
=
"dataGrid"
>
<
grid:RadDataGrid.Columns
>
<
ContentPresenter
>
</
grid:RadDataGrid.Columns
>
</
grid:RadDataGrid
>
<
RadBusyIndicator
Grid.Row
=
"0"
IsActive
=
"{Binding IsLoading}"
/>
<
PaginationToolbar
Grid.Row
=
"1"
>
</
Grid
>
</
UserControl.Content
>
</
UserControl
>
Is there any example available with columns set based on parameters/styles from outside the control itself?