Hi,
I have a ObservableCollection bound to a Dockpanel. This collection holds some data, and one of the members is a datetime field.
Now, i have created a calendar-control which requires a ObservableCollection of DateTime. Is it possible to get/make an ObservableCollection from the dockpanel?
Let me show some xaml to make it a bit more clear:
<UserControl x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Convertor="clr-namespace:MyApp.Convertors"
xmlns:View="clr-namespace:MyApp.Views.WorkItems"
xmlns:ViewModel="clr-namespace:MyApp.ViewModel.WorkItems"
MinHeight="100" MinWidth="100">
<!-- resources -->
<UserControl.Resources>
<Convertor:StatusConverter x:Key="statusConverter" />
<Convertor:FormattingConverter x:Key="formattingConverter" />
<!-- the view model -->
<ViewModel:Model x:Key="viewModel" />
</UserControl.Resources>
<!-- main dockpanel with the viewModel as datacontext -->
<DockPanel DataContext="{StaticResource viewModel}">
<!--
SelectedDates is a public ObservableCollection<DateTime>,
How would i get all the "plannedDates" as a collection? without (!) using the codebehind ?
-->
<View:Calendar SelectedDates="" />
<ListBox ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Description}" />
<TextBlock Text="{Binding PlannedDate}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- etc -->
</DockPanel>
Thanks in advance! steve