zoukankan      html  css  js  c++  java
  • (WPF)依赖属性



    属性触发器:

            <Button MinWidth=" 75" Margin="10">
                           
                <Button.Style>
                    <Style TargetType="{x:Type Button}">
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Foreground" Value="Blue"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
                    
                        OK
            </Button>

    数据触发器:


            <Style TargetType="TextBlock">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=Text}" Value="8">    //使源元素为目标元素本身的TextBlock的Text属性。

                                                                                                                      // 满足条件:Value=8
                        <Setter Property="Foreground"
                                Value="Red"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <TextBlock Height="Auto"
                       HorizontalAlignment="Center"
                       Margin="0"
                       Name="textBlock1"
                       Text="8"
                       VerticalAlignment="Center"
                       Grid.Row="1" />




    事件触发器:

      <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
          <EventTrigger.Actions>         
            <BeginStoryboard>
              <Storyboard SpeedRatio="1">
                  
                <DoubleAnimation Storyboard.TargetName="element"
                                    Storyboard.TargetProperty="Opacity"
                                    From="0.2" To="1" Duration="0:0:2.5"></DoubleAnimation>
              </Storyboard>
            </BeginStoryboard>
          </EventTrigger.Actions>      
        </EventTrigger>
      </Window.Triggers>


  • 相关阅读:
    oracle数据库数据导出
    oracle 数据连接方式
    plsql 建表空间
    java Excel 导入数据库
    python爬虫学习数据分析(连载中)
    python之pip库管理工具pip安装
    数据结构之看病排队系统
    数据结构之顺序串
    数据结构之链队
    数据结构之环形队列
  • 原文地址:https://www.cnblogs.com/slgkaifa/p/6784404.html
Copyright © 2011-2022 走看看