locked
Static Classes Not Appearing as Potential Binding Data Source RRS feed

  • Question

  • Hi All,

    This is more of a query/request rather than a question.  I'm just doing a bit of testing on Binding and DataSources and am wondering why this class doesn't appear as a data source when clicking the "+CLR Object" button in the Blend UI.  The class is:

    using System.Collections.ObjectModel; 
     
    namespace StaticDataBindingTest.Data 
        public static class StaticDataSource 
        { 
            public static ObservableCollection<string> StaticData = new ObservableCollection<string>(); 
     
            static StaticDataSource() 
            { 
            } 
     
            public static void InitialiseData() 
            { 
                StaticData.Clear(); 
                StaticData.Add("This is item1"); 
                StaticData.Add("This is item2"); 
                StaticData.Add("This is item3"); 
            } 
     
            public static void UpdateData() 
            { 
                StaticData.Clear(); 
                StaticData.Add("This is updated data"); 
            } 
        } 

    There is absolutely no problem binding a XAML combo box to this class using:

    ItemsSource="{Binding Source={x:Static data:StaticDataSource.StaticData}}"

    I'm just wondering why Blend doesn't show this class as a potential datasource.  Any info would be useful.

    Thanks,

    jammer
    Thursday, July 10, 2008 10:18 AM

All replies