Class BrushExtension
Defines a System.Windows.Markup.MarkupExtension to provide a System.Windows.Media.Brush based on the given BrushResourceKey.
Inheritance
Namespace: Sartorius.SAF.Presentation.Controls.Markup
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public class BrushExtension : WpfResourceMarkupExtensionBase<Brush, BrushResourceKey>
Examples
This example illustrates how to use the BrushExtension to set various System.Windows.Controls.Control.Background and System.Windows.Controls.Border.BorderBrush.
<UserControl x:Class="Sartorius.SAF.Documentation.Examples.Controls.Markup.BrushExtensionExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:SAF="http://www.sartorius.com/SAF">
<Grid Background="{SAF:Brush Background09}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="39" />
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1"
Background="{SAF:Brush Background08}"
BorderBrush="{SAF:Brush Border19}">
<HeaderedContentControl Style="{SAF:Style HeaderedContentControl}"
BorderBrush="{SAF:Brush Border13}"
Margin="0,0,3,3">
<HeaderedContentControl.Header>
<TextBlock Text="User Details"
Style="{SAF:Style TextBlockContentBoxHeader}" />
</HeaderedContentControl.Header>
<Grid Margin="20,10,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition MinHeight="28"
Height="Auto" />
</Grid.RowDefinitions>
<SAF:Caption Text="First Name"
Grid.Row="0"
Indicator="Required"
Style="{SAF:Style CaptionContentBox}" />
<TextBox Grid.Row="0"
Grid.Column="2"
Text="{Binding FirstName, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Style="{SAF:Style TextBoxSingleLine}" />
</Grid>
</HeaderedContentControl>
</Border>
<Border Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
BorderThickness="1,1,0,0"
BorderBrush="{SAF:Brush Border10}">
<UniformGrid Rows="1">
<Button Style="{SAF:Style ButtonPrimary}"
Command="{Binding SaveCommand}"
Content="Save" />
<Button Style="{SAF:Style ButtonSecondary}"
Command="{Binding CancelCommand}"
Content="Cancel" />
</UniformGrid>
</Border>
</Grid>
</UserControl>
Constructors
View SourceBrushExtension(BrushResourceKey)
Creates a new instance of the BrushExtension class.
Declaration
public BrushExtension(BrushResourceKey resourceKey)
Parameters
Type | Name | Description |
---|---|---|
BrushResourceKey | resourceKey | The resource key. |
BrushExtension(BrushResourceKey, BrushResourceKey)
Creates a new instance of the BrushExtension class with the specified base resource key and overlay resource key.
Declaration
public BrushExtension(BrushResourceKey resourceKey, BrushResourceKey overlayResourceKey)
Parameters
Type | Name | Description |
---|---|---|
BrushResourceKey | resourceKey | The resource key. |
BrushResourceKey | overlayResourceKey | The overlay resource key. |
Methods
View SourceProvideValue(IServiceProvider)
When implemented in a derived class, returns an object that is provided as the value of the target property for this markup extension.
Declaration
public override object ProvideValue(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | serviceProvider | A service provider helper that can provide services for the markup extension. |
Returns
Type | Description |
---|---|
System.Object | The object value to set on the property where the extension is applied. |