This question is locked. New answers and comments are not allowed.
Hi I am copying your example from the demos.
Calendar.Silverlight/FirstLook
You have this bit of code which populates the calendar with events. How do i go about using an observablecollection from my viewmodel. Here is your code
You have hardcoded your events section, however please show me how this will be done when populating from a database or viewmodel. Thanks
Calendar.Silverlight/FirstLook
You have this bit of code which populates the calendar with events. How do i go about using an observablecollection from my viewmodel. Here is your code
<local:EventsCollection x:Key="EventsList"> <local:Event Day="2" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" /> <local:Event Day="2" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" /> <local:Event Day="2" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" /> <local:Event Day="3" Title="What's new in WCF 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Grace Becerra; Start Time - 10.00 AM" /> <local:Event Day="3" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" /> <local:Event Day="3" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" /> <local:Event Day="4" Title="What's new in WCF 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Grace Becerra; Start Time - 10.00 AM" /> <local:Event Day="4" Title="Multimedia in Silverlight 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Jeremy Boatner; Start Time - 12.00 PM" /> <local:Event Day="5" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" /> <local:Event Day="5" Title="Multimedia in Silverlight 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Jeremy Boatner; Start Time - 2.00 PM" /> <local:Event Day="5" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" /> <local:Event Day="8" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 9:45 AM" /> <local:Event Day="8" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 2.00 PM" /> <local:Event Day="8" Title="Multimedia in Silverlight 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Jeremy Boatner; Start Time - 4.00 PM" /> <local:Event Day="11" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" /> <local:Event Day="11" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 4.00 PM" /> <local:Event Day="14" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 11.45 PM" /> <local:Event Day="14" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 1.15 PM"/> <local:Event Day="14" Title="Multimedia in Silverlight 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Jeremy Boatner; Start Time - 3.00 PM" /> <local:Event Day="15" Title=" Windows Phone 7 Development" Company="Telerik Inc - Texas, USA" Description="Speaker: Brenda Smith; Start Time - 12:00 AM" /> <local:Event Day="15" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" /> <local:Event Day="17" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 11.15 AM" /> <local:Event Day="17" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 1:30 PM" /> <local:Event Day="17" Title="What's new in WCF 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Grace Becerra; Start Time - 3.00 PM" /> <local:Event Day="24" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 12.00 AM" /> <local:Event Day="24" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 2.15 PM"/> <local:Event Day="24" Title=" Windows Phone 7 Development" Company="Telerik Inc - Texas, USA" Description="Speaker: Brenda Smith; Start Time - 5:00 PM" /> <local:Event Day="25" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 10.00 AM" /> <local:Event Day="25" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" /> <local:Event Day="25" Title=" Windows Phone 7 Development" Company="Telerik Inc - Texas, USA" Description="Speaker: Brenda Smith; Start Time - 3:00 PM" /> <local:Event Day="27" Title="What's new in WCF 4" Company="Telerik Inc - Boston, USA" Description="Speaker: Grace Becerra; Start Time - 10.00 AM" /> <local:Event Day="27" Title="Blend For Silverlight Developers" Company="Telerik Inc - Texas, USA" Description="Speaker: Tom Black; Start Time - 2.00 PM" /> <local:Event Day="28" Title="Integrating WPF and WCF" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Wildermuth; Start Time - 1.00 PM" /> <local:Event Day="28" Title="The Future Of Web Development" Company="Telerik Inc - Boston, USA" Description="Speaker: Tom Black; Start Time - 2:00 PM"/> <local:Event Day="28" Title=" Windows Phone 7 Development" Company="Telerik Inc - Texas, USA" Description="Speaker: Brenda Smith; Start Time - 4:00 PM" /> </local:EventsCollection> <CollectionViewSource x:Key="EventsView" x:Name="EventsList" Filter="EventsList_Filter" Source="{StaticResource EventsList}" /> <local:EventDayTemplateSelector x:Key="EventDayTemplateSelector" EventsCollection="{StaticResource EventsList}"> <local:EventDayTemplateSelector.DefaultTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" /> </DataTemplate> </local:EventDayTemplateSelector.DefaultTemplate> <local:EventDayTemplateSelector.EventTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" Foreground="#FF000000" FontWeight="Bold" /> </DataTemplate> </local:EventDayTemplateSelector.EventTemplate> </local:EventDayTemplateSelector>You have hardcoded your events section, however please show me how this will be done when populating from a database or viewmodel. Thanks