Any way to change the selected color of the MDI tabs?

Docking/MDI for WPF Forum

Posted 3 months ago by eric
Version: 22.1.0
Avatar

Hi all,

in our application we choose to use the standard MDI layout instead of the tabs MDI for the documents.

However when 2 documents are side-by-side it becomes really hard to distinguish which one is actually selected.

The default theme seems to change the document border with a slighty darker gray then the non-selected one. It is almost impossible to see the difference.

Basically what we would like to do is to change the document "Title bar" to a different color for the selected document (maybe a light blue color).

It there a way to do this? Maybe by modifying a by the template? 

Another possibility would be to change the actual border color used for the selected document.

Thank you!

Comments (5)

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

Hi Eric,

Yes, you could do this within the docking:StandardMdiHost element in XAML to alter the active title bar background brush:

<docking:StandardMdiHost.Resources>
	<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.WindowTitleBarBackgroundActiveBrushKey}" Color="Red" />
</docking:StandardMdiHost.Resources>

Or you could alter another brush instead, like WindowBorderActiveBrushKey if you prefer.


Actipro Software Support

Posted 3 months ago by eric
Avatar

It works great!

FYI this is what i did in case someone else is wondering:

<docking:StandardMdiHost>
<docking:StandardMdiHost.Resources>
<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.WindowTitleBarBackgroundActiveBrushKey}"
Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" />
</docking:StandardMdiHost.Resources>
</docking:StandardMdiHost>

Thank you!

Posted 2 months ago by eric
Avatar

Actually i have another question.

Is there a way to prevent the Standard MDI window to "deselect" itself when you click outside the document or when you focus on another element which is not in the MDI host?

Current when i focus on a text box somewhere else, lets say in the ribbon, the MDI document color becomes "unselected" but the document remains the active one. This may be confusing to a user using my application.

Thank you again

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Eric,

The highlight currently follows keyboard focus.  You could possibly track the DockSite.PrimaryDocument and watch for the PrimaryDocumentChanged event notifying you that the property has changed.  Set an attached property on the DocumentWindow that is primary and show some highlight or border within the DocumentWindow's content when that attached property is true.


Actipro Software Support

Posted 2 months ago by eric
Avatar

Hi, so i achieve similar results as what you proposed by using a Style instead of an attached property like so:

    <docking:DockSite.Resources>
        <Style x:Key="DocumentItemStyle" TargetType="{x:Type docking:DocumentWindow}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsActive, Mode=OneWay}" Value="True">
                    <Setter Property="BorderThickness" Value="3"/>
                    <Setter Property="BorderBrush" Value="{x:Static SystemColors.ActiveCaptionBrush}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding IsActive, Mode=OneWay}" Value="False">
                    <Setter Property="BorderThickness" Value="0"/>
                    <Setter Property="BorderBrush" Value="{x:Null}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

However this is not exactly what we hoped to achieve but is sufficient for the time being.

It would be really great if the control would offer another themes:AssetResourceKeys for when the titlebar is Active but not focused.

Im guessing it would not be so hard to achieve since the DocumentWindow already knows that the document is active but not focused.

Thank you for your help.

The latest build of this product (v22.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.