我使用Contentcontrol来显示程序的用户控件,现在我在搜索后关闭用户控件出现了问题,我发现了一个在DockPanel上加载用户控件的例子
现在我的问题是:
ucChild=ContentControl)
发布于 2018-06-07 04:04:47
对于像WinForms这样编写
的人来说,WPF标准免责声明:优先;像这样直接操作UI是一个坏主意。您应该修改视图模型并允许绑定系统更新UI。使用MVVM模式;WPF将为您工作,而不是对您不利
回答你的实际问题:
FrameworkElement
,但就共性而言仅此而已。- A `DockPanel` is as the name suggests, a `Panel`. That is; it controls the layout and sizing of one or more child elements. Specifically, `DockPanel` is good at situations like the following: you want an element to use up a full column of width, then another span the top (except for the previous element) and have the last element fill the remaining space.
- A `ContentControl` is basically a placeholder, its purpose is to expose a settable (and most importantly, bindable) `Content` property that you can stuff another control into. Even better; you can put an actual _object_ there and use a `DataTemplate` to control the display (this approach would conform to MVVM).
ContentControl
不是Panel
,因此没有Children
属性。https://stackoverflow.com/questions/50728311
复制相似问题