WPF UpdateSourceTrigger的使用

<Window x:Class="XamlTest.Window8"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window8" Height="300" Width="300">
    <Grid>
        <StackPanel>

            <TextBox Text="{Binding ElementName=slider, Path=Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>    

//      PropertyChanged:更改后直接更新源 

 <!--<TextBox Text="{Binding ElementName=slider, Path=Value, UpdateSourceTrigger=LostFocus}"></TextBox>-->

//      LostFocus:失去焦点后更新源 

<!--<TextBox Text="{Binding ElementName=slider, Path=Value, UpdateSourceTrigger=Explicit}"></TextBox>-->

//      Explicit:不更新源 

 <Slider Name="slider" Minimum="1" Maximum="100" TickPlacement="BottomRight" TickFrequency="1"></Slider>
        </StackPanel>
    </Grid>
</Window>
原文地址:https://www.cnblogs.com/dxmfans/p/9434629.html