Files
ShrlAlgoToolkit/WPFluent/Controls/Image/Image.xaml

56 lines
2.5 KiB
Plaintext
Raw Normal View History

<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
Based on Microsoft XAML for Win UI
Copyright (c) Microsoft Corporation. All Rights Reserved.
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFluent.Controls">
<Style x:Key="DefaultImageStyle" TargetType="{x:Type controls:Image}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Image}">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ClipToBounds="True"
CornerRadius="{TemplateBinding CornerRadius}">
<Image
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{TemplateBinding Source}"
Stretch="{TemplateBinding Stretch}"
StretchDirection="{TemplateBinding StretchDirection}">
<Image.OpacityMask>
<VisualBrush>
<VisualBrush.Visual>
<Border
Width="{TemplateBinding ActualWidth}"
Height="{TemplateBinding ActualHeight}"
Background="White"
CornerRadius="{TemplateBinding InnerCornerRadius}" />
</VisualBrush.Visual>
</VisualBrush>
</Image.OpacityMask>
</Image>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource DefaultImageStyle}" TargetType="{x:Type controls:Image}" />
</ResourceDictionary>