Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

Expose Inner Control of WPF Control

Skip to first unread message

Martin Robins

Jan 19, 2009, 3:09:35 PM1/19/09
I have a WPF control (derived from System.Windows.Controls.Control) that I
am creating, it will be used to apply a common look and feel to a form.
I have defined the XAML (in Generic.xaml) as follows...

<Style TargetType="{x:Type local:Dialog}">
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type local:Dialog}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">

<RowDefinition />
<RowDefinition Height="Auto"/>

<DockPanel Grid.Row="0" Margin="5">
<TabControl Name="PART_TabControl">
<DockPanel Grid.Row="1" LastChildFill="False"
HorizontalAlignment="Right" Margin="5">
<Button IsDefault="True">OK</Button>
<Button IsCancel="True">Cancel</Button>


What I would like to do is to expose the TabControl as a property of my
control so that I can use it as follows...

<TabItem Header="Tab #1">
<TextBlock Text="Hello"></TextBlock>
<TabItem Header="Tab #2">
<TextBlock Text="World"></TextBlock>

Please note that the usage above is only an example, I may also want to
access other properties of the TabControl and as such, merely binding the
ItemsSource property of the TabControl to an ObservableCollection<TabItem>,
while it addresses the specific example above, does not provide all of the
functionality that I would like.

Does anybody have any suggestions as to how I might achieve this?


0 new messages