I am having problem in binding to the Datacontext at viewdefinition level, It works if i create my viewmodel in xaml and set the DataContext of the grid using staticresource, but if i set the datacontext to the window in code behind it does not work
<schedule:RadScheduleView.ViewDefinitions>
<schedule:DayViewDefinition GroupFilter="{Binding GroupFilter2}"/>
<schedule:WeekViewDefinition GroupFilter="{Binding GroupFilter2}"/>
<schedule:MonthViewDefinition GroupFilter="{Binding GroupFilter2}"/>
</schedule:RadScheduleView.ViewDefinitions>
----------- this does not work, does no bind to Group Filter -----------------
public MainWindow()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
----------- this works -------------------
<Window.Resources>
<local:ViewModel x:Key="ViewModel" AppointmentsSource="/Schedule;component/Appointments.xaml" />
<Grid x:Name="mainGrid" DataContext="{StaticResource ViewModel">
<schedule:RadScheduleView.ViewDefinitions>
<schedule:DayViewDefinition GroupFilter="{Binding GroupFilter2}"/>
<schedule:WeekViewDefinition GroupFilter="{Binding GroupFilter2}"/>
<schedule:MonthViewDefinition GroupFilter="{Binding GroupFilter2}"/>
</schedule:RadScheduleView.ViewDefinitions>
----------- this does not work, does no bind to Group Filter -----------------
public MainWindow()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
----------- this works -------------------
<Window.Resources>
<local:ViewModel x:Key="ViewModel" AppointmentsSource="/Schedule;component/Appointments.xaml" />
<Grid x:Name="mainGrid" DataContext="{StaticResource ViewModel">