4 Answers, 1 is accepted
0
Hi Tgaud,
You can hook for RadGridView.CellValidating event and you can get the actual edit element from e.EditingElement property. At this time you can validate your custom template and set e.IsValid to true or false accordingly.
On the other hand you can validate entered data on a data layer. For more information you can take a look at this blog post.
In order to create custom template for editing you have to use GridViewColumn.CellEditTemplate property. This approach is demonstrated with this online example.
I know that the examples are for Silverlight but they are valid for WPF too.
Greetings,
Nedyalko Nikolov
the Telerik team
You can hook for RadGridView.CellValidating event and you can get the actual edit element from e.EditingElement property. At this time you can validate your custom template and set e.IsValid to true or false accordingly.
On the other hand you can validate entered data on a data layer. For more information you can take a look at this blog post.
In order to create custom template for editing you have to use GridViewColumn.CellEditTemplate property. This approach is demonstrated with this online example.
I know that the examples are for Silverlight but they are valid for WPF too.
Greetings,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Tgaud
Top achievements
Rank 1
answered on 13 Sep 2010, 04:18 PM
Hello, thanks for answering this.
You demonstrate how to have a template in a cell, but my problem is different.
My problem is :
How can I bind two different object, in the same cell.
If I want, in the same cell, to Bind Both Checkbox and textbox
Thank you
You demonstrate how to have a template in a cell, but my problem is different.
My problem is :
How can I bind two different object, in the same cell.
If I want, in the same cell, to Bind Both Checkbox and textbox
Thank you
0
Hello Tgaud,
DataContext of any cell within RadGridView is an instance of your business object. For example if RadGridView is bound to an ObservableCollection<Person>, DataContext of any cell will be an instance of Person class. Now let's assume that Person has two properties FirstName and IsMarried.
I hope this helps.
All the best,
Nedyalko Nikolov
the Telerik team
DataContext of any cell within RadGridView is an instance of your business object. For example if RadGridView is bound to an ObservableCollection<Person>, DataContext of any cell will be an instance of Person class. Now let's assume that Person has two properties FirstName and IsMarried.
<
telerik:GridViewDataColumn
Header
=
"Complex column"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
StackPanel
>
<
CheckBox
IsChecked
=
"{Binding IsMarried, Mode=TwoWay}"
/>
<
TextBox
Text
=
"{Binding FirstName, Mode=TwoWay}"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
I hope this helps.
All the best,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Tgaud
Top achievements
Rank 1
answered on 15 Sep 2010, 10:01 AM
Yeah but it's two property of the same object... it's not two different object..