views:

32

answers:

1

hi, i have a base WPF window and a second WPF window which derived from it. if i add new items to the child's window, i can not see the buttons that derived from the base window anymore.

anyone? idea??? thanx! tali

A: 

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>
WaltiD
how to use it? i have the buttons which want that will be common in all windows (with their logic)thanx!
talia
@talia: Share more details on tha button and the logic used.
Veer
buttons "OK" and "Cancel". send a report to the main program about the progress of the sub WPF windows.
talia
@talia: Yeah, without more informations about the button and it's logic it's gonna be difficult...See my edit above..
WaltiD
thanx! i think i got it :)
talia