TextBox要素にテキストが含まれていないときにスタイルを適用する方法を見つけようとしています。 TextBoxにテキストが含まれていない場合や、テキストが含まれていない場合など、TextBoxの背景色を変えたいとします。Windows PhoneのTextBoxにテキストが含まれていないときにスタイルを適用します。
トリガーは私がSilverlight(afaik)で使用できるものではないので、これを行う別の方法はありますか?この動作のためだけに、TextBoxのカスタム実装を記述するのが好きではありません。ありがとう。
私は、デフォルトの動作(ConditionBehavior)を使用して終了:
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged">
<i:Interaction.Behaviors>
<ec:ConditionBehavior>
<ec:ConditionalExpression>
<ec:ComparisonCondition LeftOperand="{Binding Text, ElementName=textBox}" RightOperand="" Operator="NotEqual"/>
</ec:ConditionalExpression>
</ec:ConditionBehavior>
</i:Interaction.Behaviors>
<ec:ChangePropertyAction PropertyName="Background" Value="{StaticResource PhoneTextBoxBrush}" />
</i:EventTrigger>
<i:EventTrigger EventName="TextChanged">
<i:Interaction.Behaviors>
<ec:ConditionBehavior>
<ec:ConditionalExpression>
<ec:ComparisonCondition LeftOperand="{Binding Text, ElementName=textBox}" RightOperand="" Operator="Equal"/>
</ec:ConditionalExpression>
</ec:ConditionBehavior>
</i:Interaction.Behaviors>
<ec:ChangePropertyAction PropertyName="Background" Value="Transparent" />
</i:EventTrigger>
</i:Interaction.Triggers>
を作成
あなたのスタイルを作成スタイル –