M
Martin Robins
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
ialog}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local
ialog}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="5">
<TabControl Name="PART_TabControl">
</TabControl>
</DockPanel>
<DockPanel Grid.Row="1" LastChildFill="False"
HorizontalAlignment="Right" Margin="5">
<Button IsDefault="True">OK</Button>
<Button IsCancel="True">Cancel</Button>
</DockPanel>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
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...
<controls
ialog>
<controls
ialog.TabControl>
<TabItem Header="Tab #1">
<TextBlock Text="Hello"></TextBlock>
</TabItem>
<TabItem Header="Tab #2">
<TextBlock Text="World"></TextBlock>
</TabItem>
</controls
ialog.TabControl>
</controls
ialog>
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?
Thanks.
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

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local

<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="5">
<TabControl Name="PART_TabControl">
</TabControl>
</DockPanel>
<DockPanel Grid.Row="1" LastChildFill="False"
HorizontalAlignment="Right" Margin="5">
<Button IsDefault="True">OK</Button>
<Button IsCancel="True">Cancel</Button>
</DockPanel>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
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...
<controls

<controls

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

</controls

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?
Thanks.