WPF PriorityBinding

Published on Monday, November 14, 2011
wpf

The sample is from MSDN

<Window.Resources> 
  <c:AsyncDataSource SlowestDP="Slowest Value" SlowerDP="Slower Value" 
                     FastDP="Fast Value" x:Key="AsyncDS" /> 
</Window.Resources> 
    
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" 
  DataContext="{Binding Source={StaticResource AsyncDS}}"> 
  <TextBlock FontSize="18" FontWeight="Bold" Margin="10" 
    HorizontalAlignment="Center">Priority Binding</TextBlock> 
  <TextBlock Background="Honeydew" Width="100" HorizontalAlignment="Center"> 
    <TextBlock.Text> 
      <PriorityBinding FallbackValue="defaultvalue"> 
        <Binding Path="SlowestDP" IsAsync="True"/> 
        <Binding Path="SlowerDP" IsAsync="True"/> 
        <Binding Path="FastDP" /> 
      </PriorityBinding> 
    </TextBlock.Text> 
  </TextBlock>    
</StackPanel>