tags:

views:

120

answers:

2

I have a WPF tabcontrol with 3 tabs. On the top of the first page is a scrollviewer with a couple buttons which make up a menu of common tasks (save, load etc). I would like this scroll viewer to appear at the top of every tab. Is it possible to do this without simply copying and pasting the code to every tab?

+1  A: 

You can make a custom control that contains the UI and logic for the buttons, and then include that control on each tab. The best way to do this is to create a subclass of ScrollViewer, and in the XAML define each of the buttons. On each of your tab pages you can create and create an instance of your new subclass.

This will result in a different instance of your class on each page, but the logic for the buttons will only exist in the code once.

Andy
+1  A: 

You could implement the scroll viewer and buttons outside and on top of the tabcontrol.

Rich.Carpenter