トリガ(Trigger)

 現時点Silverlight 4.0 標準のライブラリではプロパティトリガーをサポートしませんが、Microsoft Expression Blend SDK がインストールしているなど、Blendのライブラリからプロパティトリガーの利用が可能です。
 必要のDLLファイルは下記の二つです。

  • System.Windows.Interactivity.dll
  • Microsoft.Expression.Interactions.dll

プロパティトリガーの利用例1:

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions"

<Button Content="Button" HorizontalAlignment="Right" Margin="0,150,116,0" VerticalAlignment="Top" Width="75">
   <i:Interaction.Triggers>
      <ic:DataTrigger Binding="{Binding Value, ElementName=slider}" Value="0">
          <im:ControlStoryboardAction Storyboard="{StaticResource StoryboardOpen}"/>
      </ic:DataTrigger>
      <ic:DataTrigger Binding="{Binding Value, ElementName=slider}" Value="10">
          <im:ControlStoryboardAction Storyboard="{StaticResource StoryboardClose}"/>
      </ic:DataTrigger>
   </i:Interaction.Triggers>
</Button>

利用例2:

<i:Interaction.Triggers>
   <i:EventTrigger EventName="ComboBox.SelectionChanged">
       <ic:ChangePropertyAction PropertyName="Background" TargetName="Quarry1">
           <ic:ChangePropertyAction.Value>
               <SolidColorBrush>Red</SolidColorBrush>
           </ic:ChangePropertyAction.Value>
       </ic:ChangePropertyAction>
   </i:EventTrigger>
</i:Interaction.Triggers>


本当にほしかったのはこういうブログだったんだ

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016/04/29 (金) 11:41:38 (2940d)

yVoC[UNLIMITȂ1~] ECirŃ|C Yahoo yV LINEf[^[Ōz500~`I


z[y[W ̃NWbgJ[h COiq 萔O~ył񂫁z COsیI COze