Bind property of one instantiated control : Bind to Property « Windows Presentation Foundation « C# / CSharp Tutorial






<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Width="460" Height="200"
  Title="Binding the Properties of Two Controls">
    <DockPanel>
      <TextBlock>Choose a Color:</TextBlock>
      <ComboBox Name="myComboBox" SelectedIndex="0">
        <ComboBoxItem>Green</ComboBoxItem>
        <ComboBoxItem>Blue</ComboBoxItem>
        <ComboBoxItem>Red</ComboBoxItem>
      </ComboBox>
      <Canvas>
        <Canvas.Background>
          <Binding ElementName="myComboBox" Path="SelectedItem.Content"/>
        </Canvas.Background>
      </Canvas>
    </DockPanel>
</Window>
WPF Bind Property Of One Instantiated Control








24.134.Bind to Property
24.134.1.Text Data BindingText Data Binding
24.134.2.Null property bindingNull property binding
24.134.3.Binding Property with ExceptionBinding Property with Exception
24.134.4.Binding Dependency Property to TextBlockBinding Dependency Property to TextBlock
24.134.5.Bind Your Objects to UI Control with PropertyBind Your Objects to UI Control with Property
24.134.6.Implement INotifyPropertyChanged to notify the binding targets when the values of properties change.Implement INotifyPropertyChanged to notify the binding targets when the values of properties change.
24.134.7.Property changed callbackProperty changed callback
24.134.8.Bind property of one instantiated controlBind property of one instantiated control