开发者

Referencing ItemSource in code

I have a SL4 DataGrid whose ItemsSource is set to a StaticResource pointed to a ViewModel. I need to get the collection of data items from the DataGrid in a code-behind file. Since the ItemsSourc开发者_如何学编程e is an IEnumerable, I thought this would work, but it does not.

IEnumerable listEntities = DataGrid.ItemsSource as MyEntity;

I'm sure that I just have some simple construct wrong. Any help is appreciated.

Thanks.


Did you tried IEnumerable listEntities = DataGrid.ItemsSource as IEnumerable<MyEntity>;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜