3
Vote

Missing highlight of floating document

description

When a floating document is focused its not highlighted properly. I'm not sure if it's only when using the VS2010Theme, but its easy to spot when using that theme (i.e, it stays gray, it does not get orange).

file attachments

comments

mgnu wrote Jun 10, 2013 at 12:32 PM

It worked in revision 98289

bdeem wrote Sep 26, 2013 at 7:08 PM

This issue is caused by the merging of dictionaries at run time in the LayoutFloatingWindowControl.
        internal virtual void UpdateThemeResources(Theme oldTheme = null)
        {
            if (oldTheme != null)
            {
                var resourceDictionaryToRemove =
                    Resources.MergedDictionaries.FirstOrDefault(r => r.Source == oldTheme.GetResourceUri());
                if (resourceDictionaryToRemove != null)
                    Resources.MergedDictionaries.Remove(
                        resourceDictionaryToRemove);
            }

            var manager = _model.Root.Manager;
            if (manager.Theme != null)
            {
                // This has an issue with the existing LayoutDocumentFloatingControl where it
                // doesn't work with direct properties such as Background and BorderBrush.
                Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = manager.Theme.GetResourceUri() });
            }
        }
Do one of the following.

Option A) Specify the theme in the Application.xaml and NOT in the DockManager. Unfortunately, this means you must use the same theme throughout your application.

Option B) Modify the theme to work when it's merged with limitations. I'm don't know how to fix it.
<Style x:Key="{x:Type avalonDockControls:LayoutDocumentFloatingWindowControl}" TargetType="{x:Type avalonDockControls:LayoutDocumentFloatingWindowControl}">
...
<ControlTemplate.Triggers>
...
    <MultiDataTrigger>
        <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Model.RootDocument.IsActive}" Value="True"/>
            <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Model.RootDocument.IsLastFocusedDocument}" Value="True"/>
        </MultiDataTrigger.Conditions>
<!--  Specifying these properties causes the trigger to run early and fail.
        <Setter Property="BorderBrush"
                        Value="{DynamicResource AvalonDock_ThemeVS2010_BaseColor31}" />
        <Setter Property="Background"
                        Value="{DynamicResource AvalonDock_ThemeVS2010_BaseColor31}" />
-->
        <Setter Property="Background"
                        Value="{DynamicResource AvalonDock_ThemeVS2010_BaseColor25}" TargetName="Header" />
        <Setter Property="TextElement.Foreground"
                        Value="{DynamicResource AvalonDock_ThemeVS2010_BaseColor3}"  TargetName="Header"/>
        <Setter Property="Source" TargetName="PART_ImgPinClose" Value="/Xceed.Wpf.AvalonDock.Themes.VS2010;component/Images/PinClose_Dark.png"/>
        <Setter Property="Source" TargetName="PART_ImgPinRestore" Value="/Xceed.Wpf.AvalonDock.Themes.VS2010;component/Images/PinRestore_Dark.png"/>
        <Setter Property="Source" TargetName="PART_ImgPinMaximize" Value="/Xceed.Wpf.AvalonDock.Themes.VS2010;component/Images/PinMaximize_Dark.png"/>
        <Setter Property="Source" TargetName="PART_ImgPinMenu" Value="/Xceed.Wpf.AvalonDock.Themes.VS2010;component/Images/PinMenu_Dark.png"/>
    </MultiDataTrigger>

bdeem wrote Sep 26, 2013 at 7:09 PM

To specify the theme in your Application.xaml use the following.
<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
           <ResourceDictionary Source="pack://application:,,,/Xceed.Wpf.AvalonDock.Themes.VS2010;component/Theme.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Application.Resources>
</Application>

bdeem wrote Sep 27, 2013 at 3:11 PM

The selection of tab items and highlighting is not quite right in the VS2010Theme either. I've modified the theme to behave more like Visual Studio.

Simply add the attached file to your project and specify the DocumentPaneControlStyle in your DockingManager as shown below.
  <avalonDock:DockingManager 
                             DocumentPaneControlStyle="{StaticResource AvalonDock_ThemeVS2010_DocumentPaneControlStyle_Custom}">