.


:




:

































 

 

 

 


4. ,




..

http://www.vr-online.ru/blog/osvaivaem-wpf-vmeste-chast3-ispolzuem-resursy-i-kisti-brushes-6778

:

5. WPF.

: WPF.

: WPF VS 2013 C#.

: 4 .

. WPF

, . . , .

WPF .

: , !!!

 

4. , .

, . .

, , , . .1. .



1. .


, , , . , Background , . Transparent. :

<StackPanel Orientation="Horizontal" Margin="4" Background="{StaticResource linearPanelBrush}" > <Button ToolTip="" Margin="4" Background="Transparent" BorderBrush="Transparent" > <Image Source="Icons\open.png" ></Image> </Button> <Button ToolTip="" Margin="4" Background="Transparent" BorderBrush="Transparent" > <Image Source="Icons\copy.png" ></Image> </Button> <Button Margin="4" ToolTip="" Background="Transparent" BorderBrush="Transparent" > <Image Source="Icons\clear.png" ></Image> </Button> <Button Margin="4" ToolTip="" Background="Transparent" BorderBrush="Transparent" > <Image Source="Icons\paste.png" ></Image> </Button> </StackPanel>


, , , Background Transparent. , , . .2.

Ads by Radio CanyonAd Options



2. .


, , : Margin, Backgroud, BorderBrush. , . .
, , . . :

<Window.Resources> <Style TargetType="Button" > <Setter Property="Margin" Value="4" ></Setter> <Setter Property="Background" Value="Transparent" ></Setter> <Setter Property="BorderBrush" Value="Transparent" ></Setter> </Style>....


, , TargetType Button. , . 3 Settera, Setter . , Setter Margin 4px. , , Setter Property, , Value. , Margin=4px, Background=Transparent BorderBrush=Transparent. . Xaml :

<Button ToolTip="" > <Image Source="Icons\open.png" ></Image> </Button> <Button ToolTip="" > <Image Source="Icons\copy.png" ></Image> </Button> <Button Margin="4" ToolTip="" > <Image Source="Icons\clear.png" ></Image> </Button> <Button Margin="4" ToolTip="" > <Image Source="Icons\paste.png" ></Image> </Button>


, , , Margin, Background, BorderBrush. , .
, , , . , , ? . Style, , :

<Button Style="{x:Null}" > Ok </Button>


, .
, , . , TargetType .
, , , . , , , . , , , Backgrounda . Xaml :

<Style x:Key="okButtonStyle" TargetType="Button" > <Setter Property="BorderBrush" Value="Black" ></Setter> <Setter Property="BorderThickness" Value="1" ></Setter> <Setter Property="Background" Value="{StaticResource linearPanelBrush}" ></Setter> </Style>


linearPanelBrush. , , . Setter , , . Background, . , , , Style . :
Ok
. .3. . , , , .



3. .


Setterax (Triggers). , ,

<Style.Triggers> <Trigger Property="IsMouseOver" Value="True" > <Setter Property="Foreground" Value="White" ></Setter> </Trigger> </Style.Triggers>


, . , .

<Style.Triggers><EventTrigger RoutedEvent="Mouse.MouseEnter" > <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation AutoReverse="True" Duration="0:0:1" Storyboard.TargetProperty="Opacity" To="0" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </Style.Triggers>


Duration. , . Opacity , . 0, . , AutoReverse false, .
, . , , , .

 





:


: 2016-10-06; !; : 427 |


:

:

- , .
==> ...

1875 - | 1664 -


© 2015-2024 lektsii.org - -

: 0.009 .