Silverlight and Blend - How do I programmatically access sample data?
I have created a user interface for my Silverlight application in Blend. This application is currently 开发者_如何学运维using some sample data that I created within Blend. I need to do something with this sample data at runtime.
How do I access sample data that has been created in Blend at runtime?
Thank you!
Typically this sample data is added as application resource with SampleDataSource as key. This means that you can access it like this:
((SampleDataSource)Application.Current.Resources["SampleDataSource"]).Collection
Note that SampleDataSource class is located in Expression.Blend.SampleData.SampleDataSource namespace so a using may be needed.
精彩评论