Inheritable (attached) WPF properties don't inherit into AdvancedTabControl's content

Docking/MDI for WPF Forum

Posted 3 years ago by Markus Springweiler
Version: 16.1.0631
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

If I define an inheritable property on AdvancedTabItem then the value is only inherited to the tab header but not to the selected content. Using standard TabControl the property is inherited to both.

Problem was caused by using Content-Binding+ContentTemplate instead of direct Content -- original TabControl behaves identical.

[Modified 3 years ago]

Comments (2)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Markus,

AdvancedTabControl is showing tabs for each item (which is a DockingWindow) but the DockingWindow is present in UI as a wrapper container for its own content.  So it is the root of what shows up in the tab control's content area.  Thus tabs might not get inherited properties since that is out of band from where the DockingWindow physically shows up in UI. 

I'm assuming this question is related to you trying to get a reference to data as mentioned in your other thread:

https://www.actiprosoftware.com/community/thread/23403/how-do-i-bind-from-xxxcontextcontenttemplate#111962

You would want to set the DockingWindow.DataContext property to a non-UIElement object and that will be your contextual content object.


Actipro Software Support

Posted 3 years ago by Markus Springweiler
Avatar

No no, totally unrelated to docking at all; I just used AdvancedTabControl with Left aligned tabs and overflow scrolling, which the original TabControl is not capable at all.

I applied the strike-through style to the text due to the lack of a "delete thread" button (or I just missed it, if it exists).

As said, original TabControl and AdvancedTabControl behave the same:

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TabControl>
<TabItem Header="Inheritable properties inherit into header AND content" FontSize="20" FontWeight="ExtraBold">
<StackPanel>
<TextBlock>some content also in bold and size 20</TextBlock>
</StackPanel>
</TabItem>
<TabItem Header="Inheritable properties inherit ONLY into header" FontSize="20" FontWeight="ExtraBold" Content="some content in default size and weight">
<TabItem.ContentTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</TabItem.ContentTemplate>
</TabItem>
</TabControl>
</Page>

This happens to all sort of inheritable properties, attachable or not. In my case it was my own "HelpProvider.Topic" attachable property.

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.