开发者

How to bind a property defined as usercontrol in XAML?

In XAML (Root is a UserControl), I have defined a grid with two columns. In a ViewModel layer, I have defined a property as UserControl. The ViewModel is set as DataContext of 开发者_C百科the XAML.

How I can bind this property of type UserControl declarative to the grid?

Thanks


I'm not sure how to answer your literal question, but it sounds like you are taking the wrong approach here - your presentation layer (UserControl) is getting mixed in with your business logic (view model).

I would create a property that is an observable collection of the type that is populating your datacontext. You can then bind the ItemsSource property of the grid to that property, which should give you the outcome you are after.

I hope that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜