Browse Source

Implemented OneWayToSource binding.

pull/237/head
Steven Kirk 11 years ago
parent
commit
8457645eb4
  1. 7
      samples/BindingTest/MainWindow.paml
  2. 3
      src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs
  3. 2
      src/Perspex.Base/BindingDescriptor.cs

7
samples/BindingTest/MainWindow.paml

@ -1,6 +1,9 @@
<Window xmlns="https://github.com/perspex"> <Window xmlns="https://github.com/perspex">
<StackPanel Margin="18"> <StackPanel Margin="18" Gap="4">
<TextBlock Text="{Binding SimpleBinding}"/> <TextBlock Text="{Binding SimpleBinding}"/>
<TextBox Watermark="Simple Binding" Text="{Binding SimpleBinding}"/> <TextBox Watermark="Two Way" Text="{Binding SimpleBinding}"/>
<TextBox Watermark="One Way" Text="{Binding SimpleBinding, Mode=OneWay}"/>
<TextBox Watermark="One Time" Text="{Binding SimpleBinding, Mode=OneTime}"/>
<TextBox Watermark="One Way To Source" Text="{Binding SimpleBinding, Mode=OneWayToSource}"/>
</StackPanel> </StackPanel>
</Window> </Window>

3
src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBinding.cs

@ -58,7 +58,8 @@ namespace Perspex.Markup.Xaml.DataBinding
case BindingMode.OneTime: case BindingMode.OneTime:
throw new NotImplementedException(); throw new NotImplementedException();
case BindingMode.OneWayToSource: case BindingMode.OneWayToSource:
throw new NotImplementedException(); Target.GetObservable(TargetProperty).Subscribe(new ExpressionSubject(observable));
break;
} }
} }
} }

2
src/Perspex.Base/BindingDescriptor.cs

@ -27,7 +27,7 @@ namespace Perspex
TwoWay, TwoWay,
/// <summary> /// <summary>
/// Copies the target to the source one time and then disposes of the binding. /// Updates the target when the application starts or when the data context changes.
/// </summary> /// </summary>
OneTime, OneTime,

Loading…
Cancel
Save