inherit WPF window, why i can not see the Parent's buttons in the child's window
i have a base WPF window and a second WPF window which derived from it. if i add new items to the child's win开发者_如何学Cdow, i can not see the buttons that derived from the base window anymore.
anyone? idea??? thanx! tali
There is no visual inheritance in WPF. You should use a UserControl instead.
Edit:
<UserControl x:Class="MyUserControl">
<StackPanel>
<Button Content="Push me" Click="MyClickHandlerInUserControl" />
</StackPanle>
</UserControl>
You can use this UserControl in any View 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>
精彩评论