Die Ressourcen Wörterbücher

 

 

MainWindow.xaml:

<Window x:Class="WPFGlassKnopfRessourcen.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPFGlassKnopfRessourcen"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">

 

<Grid>

<Grid.Background>
<ImageBrush ImageSource="PMD-UV-Silver-60-Prozent.jpg"/>
</Grid.Background>
<Button Content="Programm starten ..." Width="250" Height="75" Style="{DynamicResource GlasKnopf}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0 10" />

</Grid>
</Window>


App.xaml:

<Application x:Class="WPFGlassKnopfRessourcen.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFGlassKnopfRessourcen"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="GlasKnopfDictionary.xaml" />
<!-- HIER KÖNNTEN WEITERE STEHEN !!!-->
<ResourceDictionary>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontWeight" Value="ExtraBold" />
</Style>
</ResourceDictionary>


</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</Application.Resources>
</Application>

 

DictionaryGlasKnopf.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFGlassKnopfRessourcen">


<!--Ressource für den Glasknopf-->
<Style x:Key="GlasKnopf" TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="ButtonBorder"
CornerRadius="30,30,30,30"
BorderThickness="2,2,2,2"
Background="#AA000000"
BorderBrush="#99FFFFFF"
RenderTransformOrigin="0.5,0.5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="1.8*" />
</Grid.RowDefinitions>
<Border Grid.Row="0" CornerRadius="15,15,0,0">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,2">
<GradientStop Color="#08FFFFFF" Offset="0" />
<GradientStop Color="#88FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<ContentPresenter x:Name="ButtonContentPresenter"
VerticalAlignment="Center"
Grid.RowSpan="2"
HorizontalAlignment="Center" />


</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform" TargetName="ButtonBorder">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleX="0.8" ScaleY="0.8" />
</TransformGroup>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


</ResourceDictionary>

 

 

Top