Matt Cartlidge
asked on
WPF/XAML: Moving resources from the app.xaml file and allowing global access all round
Okay, so I've created a few resource dictionaries in my application.
However, the app.xaml is getting really big so it's getting difficult to manage. I know how to create a new resource dictionary file. However, I'm struggling to find a way for the all of the resource dictionaries to access eachother's resources if I'm not placing them all in the same location.
Here's an example of some color resources I want to re-locate.
Plus Styles ...
I imagine it's pretty simple but I don't seem to be able to find the answer. Maybe I'm using the wrong terminology?
However, the app.xaml is getting really big so it's getting difficult to manage. I know how to create a new resource dictionary file. However, I'm struggling to find a way for the all of the resource dictionaries to access eachother's resources if I'm not placing them all in the same location.
Here's an example of some color resources I want to re-locate.
<Color x:Key="ContentAreaColorLight">#686868</Color>
<Color x:Key="ContentAreaColorDark">#1E1E1E</Color>
<Color x:Key="DisabledControlLightColor">#FFE8EDF9</Color>
<Color x:Key="DisabledControlDarkColor">#FFC5CBF9</Color>
<Color x:Key="DisabledForegroundColor">#FF888888</Color>
Plus Styles ...
<SolidColorBrush x:Key="ColourBackgroundWindowGeneral" Color="#333337" />
<SolidColorBrush x:Key="ColourForegroundWindowGeneral" Color="#E6E6E6" />
<SolidColorBrush x:Key="ColourGroupboxGeneral" Color="#569CD6" />
<SolidColorBrush x:Key="ColourCheckboxGeneral" Color="#B99E65" />
<SolidColorBrush x:Key="ColourButtonHoverGeneral" Color="#686868" />
<SolidColorBrush x:Key="ColourButtonDisabledGeneral" Color="#686868" />
<Style x:Key="StyleWindowGeneral" TargetType="Window">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=ColourForegroundWindowGeneral}" />
<Setter Property="Background" Value="{DynamicResource ResourceKey=ColourBackgroundWindowGeneral}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="ResizeMode" Value="CanResizeWithGrip" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="ShowInTaskbar" Value="False" />
</Style>
I imagine it's pretty simple but I don't seem to be able to find the answer. Maybe I'm using the wrong terminology?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER