Hello,
I have a I think very simple question but I cant find any solution for it. Its about binding other properties, besides the DataMemberBinding to the current item.
The scenario is as follows, I have a data object which is setup as follows:
public
class
EmployeeViewModel
{
public
Employee EmployeeData {
get
;
set
; }
public
EmployeeViewState ViewState {
get
;
set
; }
}
public
class
Employee
{
public
string
Name {
get
; }
}
public
class
EmployeeViewState
{
public
bool
ColumnNameReadOnly =
true
;
}
In my main viewmodel I have the following:
public
class
ViewModel
{
public
ObservableCollection<EmployeeViewModel> Employees {
get
;
set
; }
}
Now I want to bind my view to this collection, I have the following XAML:
<
telerik:RadGridView
x:Name
=
"grid"
MinHeight
=
"400"
DataContext
=
"{Binding}"
ItemsSource
=
"{Binding Employees}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name:"
DataMemberBinding
=
"{Binding Path=EmployeeData.Name}"
Width
=
"215"
IsReadOnly
=
"{Binding Path=ViewState.ColumnNameReadOnly}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
The Name property of the EmployeeData object is correctly bind to the current item of the row, but the IsReadOnly property binding is looking for a ViewState object in my main viewmodel!
How can I set the datacontext for this property the same as with the DataMemberBinding?
Regards,
Marcel