1
我一直在努力得到这个例子的工作,但似乎有代码标签目标代码中的错误,因为当你点击第二个标签时,焦点被设置为DatePicker而不是TextBox,无论您首先点击哪个标签,当您输入日期时,第二个标签仍将其设置为DatePicker。Label Target =“{Binding ElementName = UIName}”错误,还是仅仅是我?
<!-- Unbound Date of Birth field -->
<sdk:Label Content="Date of Birth" IsRequired="True" Margin="5" />
<StackPanel Orientation="Horizontal" Grid.Column="1">
<sdk:DatePicker Height="23" />
<sdk:DescriptionViewer Description="Please enter your date of birth."/>
</StackPanel>
<!-- ID Number field -->
<sdk:Label Grid.Row="1" Margin="5" Target="{Binding ElementName=tbIdNumber}" />
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1">
<TextBox x:Name="tbIdNumber" Height="23" Width="100"
Text="{Binding IdNumber, Mode=TwoWay,
ValidatesOnExceptions=True, NotifyOnValidationError=True}" />
<sdk:DescriptionViewer Target="{Binding ElementName=tbIdNumber}"/>
</StackPanel>
我在MSDN link text上找到了这个例子。对我来说,这似乎是一个错误,或者我只是失去了它?
道歉,如果这是一个重复的问题...我GOOGLE了这一点,所有的例子似乎是相同的,因为目标元素没有被关注。
另一个问题,如果我可以,为什么你想要以他们的方式绑定标签?它似乎没有用于有用的目的。 我正在看它,就像HTML标签一样,因为它有一个控件的目标,你会认为它会对它做些什么。 – Paul 2010-08-13 22:42:36
啊,是的,我现在看到它..感谢花时间来解释它。 – Paul 2010-08-14 00:25:52