I have some issues with Silverlight issues with InitializeComponent and Databinding. I have a tree structure that, I guess, has to be bound with data directly with the XAML code and that binding is activated when the Main page calls "InitializeComponent".
Here is the rub. The silverlight app has to wait in a call back from a server in order to know what data to load. And this happens in the guts of the C# code long after the initialization has occurred.
So I do not know what to do. It seems only the main page can call InitializeComponent() but I have to wait until I hav开发者_运维问答e the data to load and then call InitializeComponent and that happens long after the MainPage is run.
Everything in Silverlight is designed to work with asynchronously loaded data, especially bindings.
You can initialise with bindings to properties that start empty or null. Initialise is all about parsing the Xaml into plain old C# objects (POCOs) to generate a visual tree of controls.
The bindings will update when the data changes so long as the properties make use of INotifyPropertyChanged (i.e. in the parent container that holds your lists/hierarchy) or if they are ObservableCollections they provide change notification about their contents themselves.
If you have a more specific question, please post code sample so we have something to reference.
精彩评论