MVVM support

Mar 23, 2011 at 10:36 AM

Is OutlookBar control ready for MVVM?

When i bind items to my property on ViewModel, OutlookBarButtons not work.

Xaml:

<SLOutlookBar:OutlookBar HorizontalAlignment="Left" Name="outlookBar1" VerticalAlignment="Stretch" Width="200" ItemsSource="{Binding MyItems}">
</SLOutlookBar:OutlookBar>

Code:

        private ObservableCollection<Silverlight.OutlookBar.OutlookBarButton> collection;

        public ObservableCollection<Silverlight.OutlookBar.OutlookBarButton> MyItems
        {
            get
            {
                if (collection == null)
                {
                    collection = new ObservableCollection<Silverlight.OutlookBar.OutlookBarButton>();
                    collection.Add(new Silverlight.OutlookBar.OutlookBarButton() { Header = "test1", Content = new System.Windows.Controls.TextBlock() { Text = "Content test1" } });
                    collection.Add(new Silverlight.OutlookBar.OutlookBarButton() { Header = "test2", Content = new System.Windows.Controls.TextBlock() { Text = "Content test2" } });
                }
                return collection;
            }
        }