Hello gents,
At work we are using the standard WPF TabControl, and are far from happy with it, we hate the way the VisualTree ONLY contains the selected Tab. This is not cool at all, as we have some pretty heavy views, that are expensive to recreate and making the app a bit sticky.
So I would like to try and craft a new TabControl, I understand how to do this apart from one part.
Let me explain what we would be doing for a given TabItem (we will not be using TabItems either) we may have a button and a Grid (the content).
So we may have something like
<DockPanel LastChildFill="True">
<!-- Headers For Tabs-->
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
<!-- Shows tabContent1 by making it Visible -->
<Button Content="Tab1">
<!-- Shows tabContent2 by making it Visible -->
<Button Content="Tab2">
</StackPanel>
<!-- Actual tab contents that are hidden/collapsed based on which button is clicked-->
<Grid>
<ContentControl Margin="0" x:Name="tabContent1" Visibility="Visible">
<ContentControl Margin="0" x:Name="tabContent2" Visibility="Collapsed">
</Grid>
</DockPanel>
I have tried this in a proof of concept, actually writing the XAML pretty much as above, and it rips, very fast, much better then that standard WPF tab (Shame on Microsoft).
Problem is I do not know how to accept some sort of item, that will represent a Button and some content for a given tab. I can of course, just have a Grid exposed as the Content property, which is where new Tab content can be added, and then for each tab (child within the Grid Content property) I could (in code) create a new button and add it and make sure it is wired up to control the visibility of the associated child within the Grid Content property.
Do you get me, is this clear? Does it sound ok? Is there a better way?
Obviously writing a new TabControl is no small undertaking so I will only be catering for Tabs at the Top or Bottom not left or right, too different a layout for me to do in the time I have allocated for the task.
Any ideas would be greatfully recieved.
Thanks folks
"
Upgrade to Internet Explorer 8 Optimised for MSN.
"
Download Now