我有一個基礎WPF窗口和從它派生的第二個WPF窗口。 如果我將新項目添加到孩子的窗口,我看不到從基礎窗口派生的按鈕了。繼承WPF窗口,爲什麼我看不到孩子的窗口中的父按鈕
有人嗎?理念??? thanx! thanx! tali
我有一個基礎WPF窗口和從它派生的第二個WPF窗口。 如果我將新項目添加到孩子的窗口,我看不到從基礎窗口派生的按鈕了。繼承WPF窗口,爲什麼我看不到孩子的窗口中的父按鈕
有人嗎?理念??? thanx! thanx! tali
WPF中沒有可視化繼承。您應該使用UserControl來代替。
編輯:
您可以在任何視圖e.g使用此用戶控件:
<Window x:Class="MyWindow"
xmlns:uc="clr-namespace:MyNamespace.MyUserControls" >
<StackPanel>
<uc:MyUserControl /> <!--You can use any properties you have declared in your usercontrol -->
<Button Content="Some other Button" Click="MyClickHandlerInWindow" />
</StackPanel>
</Window>
他們通常被稱爲「父」與「子」,而不是父/子。 – 2010-07-12 11:11:17