Je veux implémenter un DataTrigger
pour dire, textBox1. Lorsque Text
à l'intérieur de textBox1 est "ABC" alors je veux afficher "Data matched!" dans un autre TextBox
dire, textBox2. J'ai écrit ci-dessous le code xaml pour cela mais ça ne fonctionne pas. Je reçois le message d'erreur ci-dessous.DataTriggers: Comment cela fonctionne
'Text' member is not valid because it does not have a qualifying type name
code XAML pour cela est:
<Window x:Class="ControlTemplateDemo.Animation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Animation" Height="300" Width="607">
<Grid>
<Border Background="White">
<StackPanel Margin="30" HorizontalAlignment="Left" Width="500" Height="209">
<TextBox Name="textBox1">
<TextBox.Triggers>
<DataTrigger Binding="{Binding Path=Text}">
<DataTrigger.Value>
<sys:String>ABC</sys:String>
</DataTrigger.Value>
<Setter TargetName="textBox2" Property="Text" Value="Data matched!"/>
</DataTrigger>
</TextBox.Triggers>
</TextBox>
<TextBox Name="textBox2">
</TextBox>
</StackPanel>
</Border>
</Grid>
</Window>
est-il un problème dans la liaison?
Merci, Hemant