Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
571
Question about static resources
posted

Please can you help me understand something about static resources. On your samples you often use static datasources to load data into your controls. I can see in XAML where the object has been declared, at the top of the UserControl but where does one actually load that static resource with data in runtime???

For example I have a list of Category Objects coming through from my WCF service. How would I set up a static resource to load these objects into a xamwebcombo editor?

  • 12679
    posted

    Andrew,

    Let us know if you need further assistance with this matter.

    Thanks

  • 40030
    Suggested Answer
    Offline posted

    Hi, 

    You would load your WCF service from the object in which you're using as a static resource. 

    So, for example:

    public class MyDataProvider : INotifyPropertyChanged

    {

         IEnumerable _data;

          public IEnumerable Data

         {  

             get

             {

                     if(this._data == null)

                    {

                        // Get Data from service. 

                    }

                    return _data;

                }

     

    // When you get your data back raise the PropertyChanged event for the "Data" property.

    }

     

    then in xaml:

     

    <local:MyDataProvider  x:key="mdp"/>

     

    <ig:XamComboEditor ItemsSource={Binding Data, Source={StaticResource mdp}}/>

     

    Hope this helps, 

    -SteveZ