我试图弄清楚如何使用UpdateSourceTrigger = Explicit.
我有以下表格:
<StackPanel x:Name="LayoutRoot" Margin="10" DataContext="{Binding ElementName=Window,Mode=OneWay}"> <DockPanel> <TextBlock Text="Proxy address:" VerticalAlignment="Center"/> <TextBox Text="{Binding User.PageAddress,Mode=TwoWay,UpdateSourceTrigger=Explicit}" Margin="28,0"/> </DockPanel> <DockPanel Margin="0,5,0"> <TextBlock Text="User name:" VerticalAlignment="Center"/> <TextBox Text="{Binding User.UserName,UpdateSourceTrigger=Explicit}" Margin="46,0"> <TextBlock Text="User password:" VerticalAlignment="Center"/> <TextBox Text="{Binding User.Password,UpdateSourceTrigger=Explicit}" Margin="26,0"/> </DockPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0"> <Button Content="Ok" IsDefault="True" Width="70" Margin="0,15,0" Click="Ok_Click"/> <Button Content="Cancel" IsCancel="True" Width="70"/> </StackPanel> </StackPanel>
我不想通过x:Name调用元素来调用绑定.如果我必须通过x:Name来解决这些元素,那么就我而言,我也可以完全没有约束力.