I'd like to link a SolidColorBrush from my Window to Another SolidColorBrush in My dictionary. I didn't find something like this , and may be it's not possible ...
here is the code in my "ResourceDictionary.xaml"
<SolidColorBrush x:Key="BrushBlueTransparent" Color="#33006D8F"/>
And in my windows i want a link to this resource like this :
<SolidColorBrush x:Key="ControlColor" Color="{Binding Source={DynamicResource BrushEvasanOrange}}"/>
For now, this code don't work ...
I want to use this link because i want to use this resource in my page in a multiple "" and if the color had to be change in the futur it could be easy to change with this way.
The Brush resource is used like this:
<HeaderedContentControl
x:Name="_demandeur"
BorderBrush="{DynamicResource BrushEncadre}"
BorderThickness="1"
Padding="10"
Margin="0,20,0,0"
Header="{x:Static p:Resources.EV_Demandeur}"
>
<WrapPanel
Margin="0"
Orientation="Horizontal"
HorizontalAlignment="Left"
>
<TextBlock
TextWrapping="Wrap"
FontWeight="Normal"
Text="text"
/>
</WrapPanel>
</HeaderedContentControl>
It sounds like your problem is that
HeaderedContentControlignores itsBorderBrushproperty. There are two ways to fix this: One is to replace theHeaderedContentControl'sTemplatewith one that displays a border around the content, but that's a lot of trouble. Another is to use a subclass ofHeaderedContentControlwhich already has a template that does you want (we'll get to that last).One very simple option is to simply put a
Borderaround the control, and move theMarginto theBorderas well, so the orange border line will be inside the margin. This isn't the right answer in your specific case, but it's a good general answer to "how do I put a border around things in XAML?"But I'm wondering if
HeaderedContentControlis really what you want here.HeaderedContentControlis a base class for a variety of controls which display content with a header. The subclasses are much more commonly used, and I have a feeling that what you really want here isGroupBox, which is one of those subclasses. You'd use it just the way you were usingHeaderedContentControl: