views:

69

answers:

1

I have a WPF dialog with a couple user controls and some other standard controls. We have many uses for this dialog with specific tweaks. Right now this dialog manages all of the logic to tweak itself.

I can't help but think there's gotta be a better way. I wish I could do something like this:

Original dialog

<dialog>
   <Control1>
      <CustomHeader />
      <Control2 />
      <Etc />
   </Control1>
</dialog>

Dialog that varies slightly:

<dialog>
   <OriginalDialog>
      <CustomHeader>
         <TextBlock Text="The whole dialog will show and also include this text now" />
      </CustomHeader>
   <OriginalDialog>
</dialog>

Is there a way to do what I'm trying for or even a better way that I'm not considering?

+2  A: 

I think what you need is a UserControl.

Perhaps this link will help you out.

DanM
Or extend HeaderedContentControl. http://msdn.microsoft.com/en-us/library/system.windows.controls.headeredcontentcontrol.aspx
sixlettervariables