TcOpen

  • Articles
  • API reference
Show / Hide Table of Contents
  • Introduction
  • Conventions
    • General
    • Components
  • TcOpen Framework
    • TcoCore
      • Introduction
      • TcoContext
      • TcoObject
      • TcoTask
      • TcoState
      • TcoSequencer
      • TcoComponent
      • TcoMessenger
      • TcoLogger
      • TcoDialogs
    • TcoData
      • Introduction
    • TcoInspectors
      • Introduction
    • Howto(s)
      • How to get started using TcOpen libraries
      • How to write a sequence
      • How to include TcOpen in a project
  • TcOpen Inxton
    • Colors Material Design WPF
    • Inxton Conventions
    • Inxton.Vortex.Framework.Blazor
      • Introduction and installing
      • RenderableContentControl
      • Layouts
      • Custom libraries
      • Security

Colors in IVF = WPF

When it comes to theming and colors of WPF applications, we rely on MaterialDesignInXamlToolkit.

It's very well explained here

  • https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Brush-Names
  • https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Advanced-Theming
  • https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Custom-Palette-Hues

How to use

In your App.xaml add this dictionary.

<Application
    ...
    xmlns:tcocore="clr-namespace:TcoCore.Wpf;assembly=TcoCore.Wpf"
    ...
    />
...
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <materialDesign:BundledTheme
                    BaseTheme="Inherit"
                    ColorAdjustment="{materialDesign:ColorAdjustment}"
                    PrimaryColor="BlueGrey"
                    SecondaryColor="LightGreen" />
                <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
                <tcocore:TcoResources />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

The materialDesign:BundledTheme is a MatrialDesignXaml theme.

Second ResourceDictionary contains resources for the theme.

TcoResources is a resource dictionary generated from TcoCore.Wpf.TcoColors. Adding this resource dictionary to your project will enable you to use static brushes defined in TcoCore.Wpf.TcoColors like this

  <Button
            Background="Transparent"
            Command="{Binding TcoTask.Restore}"
            Foreground="{DynamicResource Error}" />

The Foreground is referring to the Error brush defined in TcoCore.Wpf.TcoColors.

Since these properties are static you can also acces them in codebehind, converters or anywhere you need them using TcoColors as an entry point. ie TcoColors.Primary.

  • Improve this Doc
In This Article
Back to top

Generated by DocFX | Delivered by TcOpenGroup contributors