├── .gitignore ├── CodeBinding.Rx.Test ├── CodeBinding.Rx.Test.csproj ├── ObservableExTest.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── CodeBinding.Rx ├── CodeBinding.Rx (net35).csproj ├── CodeBinding.Rx.csproj ├── CodeBinding.Rx.nuspec ├── ObservableBindingTarget.cs ├── ObservableEx.cs ├── ObservableMultiValueConverter.cs ├── ObservableValueConverter.cs ├── ObservableValueConverterBase.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── CodeBinding.Test ├── BindingExTest.cs ├── CodeBinding.Test.csproj ├── GenericBindingTarget.cs ├── GenericNotifyPropertyChanged.cs └── Properties │ └── AssemblyInfo.cs ├── CodeBinding.sln ├── CodeBinding.vsmdi ├── CodeBinding ├── BindingEx.cs ├── BindingTarget.cs ├── ClearBindingDisposable.cs ├── CodeBinding (net35).csproj ├── CodeBinding.csproj ├── CodeBinding.nuspec ├── ExpressionValueConverter.cs └── Properties │ └── AssemblyInfo.cs ├── Documentation └── Observable Extension API Specification.docx ├── LICENSE ├── Local.testsettings ├── Nuget ├── CodeBinding.Rx.nuspec └── CodeBinding.nuspec ├── README.md ├── Samples ├── MultiBinding │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MultiBinding.csproj │ └── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings ├── SingleBinding │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── SingleBinding.csproj └── UserRegistration.Rx │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MainWindowViewModel.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── UserRegistration.Rx.csproj │ ├── app.config │ └── packages.config ├── TraceAndTestImpact.testsettings └── packages ├── Rx-Core.1.0.2856.0 ├── Rx-Core.1.0.2856.0.nupkg └── lib │ ├── Net35 │ ├── System.CoreEx.chm │ ├── System.CoreEx.dll │ ├── System.CoreEx.xml │ ├── System.Observable.chm │ ├── System.Observable.dll │ ├── System.Observable.xml │ ├── System.Threading.chm │ ├── System.Threading.dll │ ├── System.Threading.xml │ └── redist.txt │ ├── Net4 │ ├── System.CoreEx.chm │ ├── System.CoreEx.dll │ ├── System.CoreEx.xml │ └── redist.txt │ └── SL4 │ ├── System.CoreEx.chm │ ├── System.CoreEx.dll │ ├── System.CoreEx.xml │ ├── System.Observable.chm │ ├── System.Observable.dll │ ├── System.Observable.xml │ └── redist.txt ├── Rx-Main.1.0.10605 ├── Rx-Main.1.0.10605.nupkg └── lib │ ├── Net35 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── Net4 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── SL3-WP │ ├── System.Reactive.XML │ └── System.Reactive.dll │ └── SL4 │ ├── System.Reactive.XML │ └── System.Reactive.dll ├── Rx-Main.1.0.2856.0 ├── Rx-Main.1.0.2856.0.nupkg └── lib │ ├── Net35 │ ├── System.Reactive.chm │ ├── System.Reactive.dll │ └── System.Reactive.xml │ ├── Net4 │ ├── System.Reactive.chm │ ├── System.Reactive.dll │ └── System.Reactive.xml │ └── SL4 │ ├── System.Reactive.chm │ ├── System.Reactive.dll │ └── System.Reactive.xml ├── Rx-Main.1.1.10425 ├── Rx-Main.1.1.10425.nupkg └── lib │ ├── Net35 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── Net4 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── SL3-WP │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── SL3 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ ├── SL4 │ ├── System.Reactive.XML │ └── System.Reactive.dll │ └── SL5 │ ├── System.Reactive.XML │ └── System.Reactive.dll ├── Rx-Xaml.1.1.10425 ├── Rx-Xaml.1.1.10425.nupkg └── lib │ ├── Net35 │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll │ ├── Net4 │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll │ ├── SL3-WP │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll │ ├── SL3 │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll │ ├── SL4 │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll │ └── SL5 │ ├── System.Reactive.Windows.Threading.XML │ └── System.Reactive.Windows.Threading.dll ├── reactiveui-core.2.3.1.0 ├── lib │ ├── Net35 │ │ ├── ReactiveUI_35.dll │ │ ├── ReactiveUI_35.pdb │ │ └── ReactiveUI_35.xml │ ├── Net4 │ │ ├── ReactiveUI.dll │ │ ├── ReactiveUI.pdb │ │ └── ReactiveUI.xml │ ├── SL3-WP │ │ ├── ReactiveUI_WP7.dll │ │ ├── ReactiveUI_WP7.pdb │ │ └── ReactiveUI_WP7.xml │ └── SL4 │ │ ├── ReactiveUI_SL4.dll │ │ ├── ReactiveUI_SL4.pdb │ │ └── ReactiveUI_SL4.xml └── reactiveui-core.2.3.1.0.nupkg ├── reactiveui-xaml.2.3.1.0 ├── lib │ ├── Net35 │ │ ├── ReactiveUI.Xaml_35.dll │ │ ├── ReactiveUI.Xaml_35.pdb │ │ └── ReactiveUI.Xaml_35.xml │ ├── Net4 │ │ ├── ReactiveUI.Blend.dll │ │ ├── ReactiveUI.Blend.pdb │ │ ├── ReactiveUI.Blend.xml │ │ ├── ReactiveUI.Xaml.dll │ │ ├── ReactiveUI.Xaml.pdb │ │ └── ReactiveUI.Xaml.xml │ ├── SL3-WP │ │ ├── ReactiveUI.Blend_WP7.dll │ │ ├── ReactiveUI.Blend_WP7.pdb │ │ ├── ReactiveUI.Blend_WP7.xml │ │ ├── ReactiveUI.Xaml_WP7.dll │ │ ├── ReactiveUI.Xaml_WP7.pdb │ │ └── ReactiveUI.Xaml_WP7.xml │ └── SL4 │ │ ├── ReactiveUI.Blend_SL4.dll │ │ ├── ReactiveUI.Blend_SL4.pdb │ │ ├── ReactiveUI.Blend_SL4.xml │ │ ├── ReactiveUI.Xaml_SL4.dll │ │ ├── ReactiveUI.Xaml_SL4.pdb │ │ └── ReactiveUI.Xaml_SL4.xml └── reactiveui-xaml.2.3.1.0.nupkg └── repositories.config /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | *.vspscc 4 | *.vssscc 5 | *.vs10x 6 | *.pidb 7 | *.userprefs 8 | bin/ 9 | Bin/ 10 | obj/ 11 | Obj/ 12 | TestResults/ 13 | Nuget/Releases/* 14 | -------------------------------------------------------------------------------- /CodeBinding.Rx.Test/CodeBinding.Rx.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A} 10 | Library 11 | Properties 12 | CodeBinding.Rx.Test 13 | CodeBinding.Rx.Test 14 | v4.0 15 | 512 16 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 3.5 40 | 41 | 42 | False 43 | ..\packages\Rx-Main.1.0.10605\lib\Net4\System.Reactive.dll 44 | 45 | 46 | 47 | 48 | False 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | {A83663D3-6899-4E65-AC31-C076AF32197A} 58 | CodeBinding.Rx 59 | 60 | 61 | {31807B71-F1B1-4B19-A049-B60CE2A46B48} 62 | CodeBinding.Test 63 | 64 | 65 | 66 | 67 | 68 | 69 | 76 | -------------------------------------------------------------------------------- /CodeBinding.Rx.Test/ObservableExTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reactive.Linq; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using CodeBinding.Test; 8 | using System.Reactive.Concurrency; 9 | 10 | namespace CodeBinding.Rx.Test 11 | { 12 | [TestClass] 13 | public class ObservableExTest 14 | { 15 | [TestMethod] 16 | public void Create_SimpleExpression() 17 | { 18 | var source = new GenericNotifyPropertyChanged(); 19 | var expected = (new int[] {0, 1, 2}).ToObservable(); 20 | 21 | var actual = ObservableEx.Create(() => source.Value); 22 | 23 | using (actual.SequenceEqual(expected) 24 | .ObserveOn(Scheduler.Immediate) 25 | .Subscribe(Assert.IsTrue, Assert.Fail)) 26 | { 27 | source.Value = 1; 28 | source.Value = 2; 29 | } 30 | } 31 | 32 | [TestMethod] 33 | public void Create_ComplexExpression() 34 | { 35 | var source1 = new GenericNotifyPropertyChanged(); 36 | var source2 = new GenericNotifyPropertyChanged(); 37 | var expected = (new int[] { 0, 1, 2 }).ToObservable(); 38 | 39 | var actual = ObservableEx.Create(() => source1.Value + source2.Value); 40 | 41 | bool completed = false; 42 | using (actual.Take(3).SequenceEqual(expected) 43 | .ObserveOn(Scheduler.Immediate) 44 | .Subscribe(Assert.IsTrue, e => Assert.Fail("Exception occured"), () => completed = true)) 45 | { 46 | source1.Value = 1; 47 | source2.Value = 1; 48 | } 49 | 50 | Assert.IsTrue(completed, "Sequence not complete"); 51 | } 52 | 53 | [TestMethod] 54 | public void Create_SimpleExpression_WrongInitialValue_CallsOnError() 55 | { 56 | var source = new GenericNotifyPropertyChanged>(); 57 | 58 | var actual = ObservableEx.Create(() => source.Value.Value); 59 | 60 | bool completed = false; 61 | Exception error = null; 62 | using (actual.Subscribe( 63 | i => Assert.Fail("OnNext"), 64 | e => error = e, 65 | () => completed = true)) 66 | { 67 | source.Value = new GenericNotifyPropertyChanged(); 68 | source.Value.Value = 1; 69 | } 70 | 71 | Assert.IsNotNull(error, "OnError not called"); 72 | Assert.IsInstanceOfType(error, typeof(NullReferenceException), "Wrong type of exception"); 73 | Assert.IsFalse(completed, "Sequence complete"); 74 | } 75 | 76 | [TestMethod] 77 | public void Create_SimpleExpression_WrongValueSet_CallsOnError() 78 | { 79 | var source = new GenericNotifyPropertyChanged>(); 80 | source.Value = new GenericNotifyPropertyChanged(); 81 | var expected = (new int[] { 0, 1 }).ToObservable(); 82 | // TODO: Add this to expected sequence after SequenceEqual is switched 83 | // to somethin more elaborate 84 | //.Concat(Observable.Throw(new NullReferenceException())); 85 | 86 | var actual = ObservableEx.Create(() => source.Value.Value); 87 | 88 | bool completed = false; 89 | Exception error = null; 90 | using (actual.SequenceEqual(expected) 91 | .ObserveOn(Scheduler.Immediate).Subscribe( 92 | Assert.IsTrue, 93 | e => error = e, 94 | () => completed = true)) 95 | { 96 | source.Value.Value = 1; 97 | source.Value = null; 98 | } 99 | 100 | Assert.IsNotNull(error, "OnError not called"); 101 | Assert.IsInstanceOfType(error, typeof(NullReferenceException), "Wrong type of exception"); 102 | Assert.IsFalse(completed, "Sequence complete"); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /CodeBinding.Rx.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodeBinding.Rx.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CodeBinding.Rx.Test")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5a8adbf1-1bc3-4dbf-a90a-a64cb17a1f26")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /CodeBinding.Rx.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CodeBinding.Rx/CodeBinding.Rx (net35).csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347} 9 | Library 10 | Properties 11 | CodeBinding.Rx 12 | CodeBinding.Rx 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\bin\net35\Debug\ 21 | TRACE;DEBUG;NET35 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\bin\net35\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | ..\packages\Rx-Main.1.1.10425\lib\Net35\System.Reactive.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {F860C2E6-ABA7-4865-B3BA-633DD4985524} 52 | CodeBinding %28net35%29 53 | 54 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /CodeBinding.Rx/CodeBinding.Rx.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {A83663D3-6899-4E65-AC31-C076AF32197A} 9 | Library 10 | Properties 11 | CodeBinding.Rx 12 | CodeBinding.Rx 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\bin\net40\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\bin\net40\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | False 40 | ..\packages\Rx-Main.1.0.10605\lib\Net4\System.Reactive.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 56 | CodeBinding 57 | 58 | 59 | 60 | 61 | 62 | 63 | 70 | -------------------------------------------------------------------------------- /CodeBinding.Rx/CodeBinding.Rx.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeBinding.Rx 5 | 1.0.0.0 6 | CodeBinding.Rx 7 | StanislawSwierc 8 | StanislawSwierc 9 | https://github.com/StanislawSwierc/CodeBinding 10 | false 11 | Create IObservable objects directly from lambda expressions using CodeBinding 12 | Create IObservable objects directly from lambda expressions using CodeBinding 13 | es-US 14 | wpf,binding,Rx,Reactive,extensions,Observable 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /CodeBinding.Rx/ObservableBindingTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Reactive.Linq; 7 | using System.Diagnostics.Contracts; 8 | using System.Reactive.Disposables; 9 | using System.Windows.Data; 10 | 11 | namespace CodeBinding.Rx 12 | { 13 | public class ObservableBindingTarget : FrameworkElement, IObservable, IDisposable 14 | { 15 | private HashSet> m_Observers; 16 | 17 | public ObservableBindingTarget() 18 | { 19 | m_Observers = new HashSet>(); 20 | } 21 | 22 | public T Value 23 | { 24 | get { return (T)GetValue(ValueProperty); } 25 | set { SetValue(ValueProperty, value); } 26 | } 27 | 28 | public static readonly DependencyProperty ValueProperty = 29 | DependencyProperty.Register("Value", typeof(T), typeof(ObservableBindingTarget), new UIPropertyMetadata(OnValueChanged)); 30 | 31 | private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 32 | { 33 | var instance = (ObservableBindingTarget)d; 34 | lock (instance.m_Observers) 35 | { 36 | foreach (var observer in instance.m_Observers.ToArray()) 37 | { 38 | observer.OnNext(instance.Value); 39 | } 40 | } 41 | } 42 | 43 | public IDisposable Subscribe(IObserver observer) 44 | { 45 | // Save observer 46 | lock (m_Observers) 47 | { 48 | m_Observers.Add(observer); 49 | } 50 | 51 | // Send current value to observer 52 | observer.OnNext(Value); 53 | 54 | return Disposable.Create(() => 55 | { 56 | lock (m_Observers) 57 | { 58 | m_Observers.Remove(observer); 59 | } 60 | }); 61 | } 62 | 63 | public void Dispose() 64 | { 65 | BindingOperations.ClearBinding(this, ObservableBindingTarget.ValueProperty); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /CodeBinding.Rx/ObservableEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Linq.Expressions; 6 | using CodeBinding; 7 | using System.Windows.Data; 8 | using System.Diagnostics.Contracts; 9 | using System.Reactive.Linq; 10 | using System.Reactive.Disposables; 11 | 12 | namespace CodeBinding.Rx 13 | { 14 | public static class ObservableEx 15 | { 16 | /// 17 | /// Creates 18 | /// 19 | /// 20 | /// 21 | /// 22 | // TODO: Change return type back to IObserbable 23 | // This will require client to save reference of the returned object 24 | public static IObservable Create(Expression> expression) 25 | { 26 | Contract.Requires(expression != null); 27 | Contract.Ensures(Contract.Result>() != null); 28 | 29 | 30 | // Create binding 31 | var binding = BindingEx.FromExpression(expression); 32 | IObservable observableConverter = null; 33 | if (binding is Binding) 34 | { 35 | var single = (Binding)binding; 36 | if (single.Converter != null) 37 | { 38 | // Create intercepting converter 39 | var converter = new ObservableValueConverter(single.Converter); 40 | // Replace original converter 41 | single.Converter = converter; 42 | observableConverter = converter; 43 | } 44 | } 45 | else if (binding is MultiBinding) 46 | { 47 | var multi = (MultiBinding)binding; 48 | // Create intercepting converter 49 | var converter = new ObservableMultiValueConverter(multi.Converter); 50 | // Replace original converter 51 | multi.Converter = converter; 52 | observableConverter = converter; 53 | } 54 | else 55 | { 56 | // Only Binding and MultiBinding classes are supported 57 | throw new InvalidOperationException("Invalid binding type"); 58 | } 59 | 60 | return Observable.Create(observer => 61 | { 62 | // Create target object 63 | var target = new ObservableBindingTarget(); 64 | if (observableConverter != null) 65 | { 66 | var subscription = observableConverter.Subscribe(observer); 67 | // Binding has to be set in order to enable converter 68 | target.SetBinding(ObservableBindingTarget.ValueProperty, binding); 69 | return new CompositeDisposable( 70 | target, 71 | subscription 72 | ); 73 | } 74 | else 75 | { 76 | target.SetBinding(ObservableBindingTarget.ValueProperty, binding); 77 | return new CompositeDisposable( 78 | target.Subscribe(observer), 79 | target 80 | ); 81 | } 82 | } 83 | ); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /CodeBinding.Rx/ObservableMultiValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | using System.Windows; 7 | using System.Reactive.Disposables; 8 | using System.Diagnostics.Contracts; 9 | 10 | namespace CodeBinding.Rx 11 | { 12 | internal class ObservableMultiValueConverter : ObservableValueConverterBase, IMultiValueConverter 13 | { 14 | private IMultiValueConverter m_Inner; 15 | 16 | public ObservableMultiValueConverter(IMultiValueConverter converter) 17 | { 18 | Contract.Requires(converter != null); 19 | 20 | m_Inner = converter; 21 | } 22 | 23 | #region IMultiValueConverter Implementation 24 | 25 | public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) 26 | { 27 | try 28 | { 29 | object result = m_Inner.Convert(values, targetType, parameter, culture); 30 | SendNext((T)result); 31 | } 32 | catch (Exception ex) 33 | { 34 | SendError(ex); 35 | } 36 | return DependencyProperty.UnsetValue; 37 | } 38 | 39 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) 40 | { 41 | throw new InvalidOperationException(); 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CodeBinding.Rx/ObservableValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | using System.Windows; 7 | using System.Reactive.Disposables; 8 | using System.Diagnostics.Contracts; 9 | 10 | namespace CodeBinding.Rx 11 | { 12 | internal class ObservableValueConverter : ObservableValueConverterBase, IValueConverter 13 | { 14 | private IValueConverter m_Inner; 15 | 16 | public ObservableValueConverter(IValueConverter converter) 17 | { 18 | Contract.Requires(converter != null); 19 | 20 | m_Inner = converter; 21 | } 22 | 23 | #region IValueConverter Implementation 24 | 25 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 26 | { 27 | try 28 | { 29 | object result = m_Inner.Convert(value, targetType, parameter, culture); 30 | SendNext((T)result); 31 | } 32 | catch (Exception ex) 33 | { 34 | SendError(ex); 35 | } 36 | return DependencyProperty.UnsetValue; 37 | } 38 | 39 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CodeBinding.Rx/ObservableValueConverterBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | using System.Windows; 7 | using System.Reactive.Disposables; 8 | using System.Diagnostics.Contracts; 9 | 10 | namespace CodeBinding.Rx 11 | { 12 | internal abstract class ObservableValueConverterBase : IObservable 13 | { 14 | private Action m_OnNext; 15 | private Action m_OnError; 16 | 17 | protected void SendNext(T value) 18 | { 19 | var handler = m_OnNext; 20 | if (handler != null) 21 | { 22 | handler(value); 23 | } 24 | } 25 | 26 | protected void SendError(Exception error) 27 | { 28 | Action handler = null; 29 | lock (this) 30 | { 31 | // Save current subscribers 32 | handler = m_OnError; 33 | 34 | // Remove all subscribers 35 | m_OnError = null; 36 | m_OnNext = null; 37 | 38 | } 39 | if (handler != null) 40 | { 41 | handler(error); 42 | } 43 | } 44 | 45 | public IDisposable Subscribe(IObserver observer) 46 | { 47 | Contract.Requires(observer != null); 48 | 49 | // Lock to make sure m_OnNext and m_OnError are managed together 50 | lock (this) 51 | { 52 | m_OnNext += observer.OnNext; 53 | m_OnError += observer.OnError; 54 | } 55 | 56 | return Disposable.Create(() => 57 | { 58 | // Check if handlers have been cleared already 59 | if (m_OnError != null) 60 | { 61 | lock (this) 62 | { 63 | m_OnNext -= observer.OnNext; 64 | m_OnError -= observer.OnError; 65 | } 66 | } 67 | } 68 | ); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /CodeBinding.Rx/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("CodeBinding.Rx")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyProduct("CodeBinding.Rx")] 10 | 11 | // Version information for an assembly consists of the following four values: 12 | // 13 | // Major Version 14 | // Minor Version 15 | // Build Number 16 | // Revision 17 | // 18 | // You can specify all the values or you can default the Build and Revision Numbers 19 | // by using the '*' as shown below: 20 | // [assembly: AssemblyVersion("1.0.*")] 21 | [assembly: AssemblyVersion("1.1.1.0")] 22 | [assembly: AssemblyFileVersion("1.1.1.0")] 23 | -------------------------------------------------------------------------------- /CodeBinding.Rx/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CodeBinding.Test/BindingExTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using System.Windows.Data; 7 | 8 | namespace CodeBinding.Test 9 | { 10 | [TestClass] 11 | public class BindingExTest 12 | { 13 | [TestMethod] 14 | public void FromExpression_SimpleBinding() 15 | { 16 | var target = new GenericBindingTarget(); 17 | var source = new GenericNotifyPropertyChanged(); 18 | 19 | BindingBase binding = BindingEx.FromExpression(() => source.Value); 20 | target.SetBinding(GenericBindingTarget.ValueProperty, binding); 21 | 22 | Assert.AreEqual(0, target.Value); 23 | source.Value = 1; 24 | Assert.AreEqual(1, target.Value); 25 | } 26 | 27 | [TestMethod] 28 | public void FromExpression_ComplexBinding() 29 | { 30 | var target = new GenericBindingTarget(); 31 | var source1 = new GenericNotifyPropertyChanged(); 32 | var source2 = new GenericNotifyPropertyChanged(); 33 | 34 | BindingBase binding = BindingEx.FromExpression(() => source1.Value + source2.Value); 35 | target.SetBinding(GenericBindingTarget.ValueProperty, binding); 36 | 37 | Assert.AreEqual(0, target.Value); 38 | source1.Value = 1; 39 | Assert.AreEqual(1, target.Value); 40 | source2.Value = 1; 41 | Assert.AreEqual(2, target.Value); 42 | } 43 | 44 | [TestMethod] 45 | public void BindFromExpression_SimpleBinding() 46 | { 47 | var target = new GenericBindingTarget(); 48 | var source = new GenericNotifyPropertyChanged(); 49 | 50 | BindingEx.BindFromExpression(() => target.Value == source.Value); 51 | 52 | Assert.AreEqual(0, target.Value); 53 | source.Value = 1; 54 | Assert.AreEqual(1, target.Value); 55 | } 56 | 57 | [TestMethod] 58 | public void BindFromExpression_ComplexBinding() 59 | { 60 | var target = new GenericBindingTarget(); 61 | var source1 = new GenericNotifyPropertyChanged(); 62 | var source2 = new GenericNotifyPropertyChanged(); 63 | 64 | BindingEx.BindFromExpression(() => target.Value == source1.Value + source2.Value); 65 | 66 | Assert.AreEqual(0, target.Value); 67 | source1.Value = 1; 68 | Assert.AreEqual(1, target.Value); 69 | source2.Value = 1; 70 | Assert.AreEqual(2, target.Value); 71 | } 72 | 73 | [TestMethod] 74 | public void BindFromExpression_SimpleBinding_DisposeSubsription_RemovesBinding() 75 | { 76 | var target = new GenericBindingTarget(); 77 | var source = new GenericNotifyPropertyChanged(); 78 | 79 | using (BindingEx.BindFromExpression(() => target.Value == source.Value)) 80 | { 81 | Assert.AreEqual(0, target.Value); 82 | source.Value = 1; 83 | Assert.AreEqual(1, target.Value); 84 | } 85 | source.Value = 2; 86 | // Value should be reseted to 0 87 | Assert.AreEqual(0, target.Value); 88 | } 89 | 90 | [TestMethod] 91 | public void BindFromExpression_ComplexBinding_DisposeSubsription_RemovesBinding() 92 | { 93 | var target = new GenericBindingTarget(); 94 | var source1 = new GenericNotifyPropertyChanged(); 95 | var source2 = new GenericNotifyPropertyChanged(); 96 | 97 | using (BindingEx.BindFromExpression(() => target.Value == source1.Value + source2.Value)) 98 | { 99 | Assert.AreEqual(0, target.Value); 100 | source1.Value = 1; 101 | Assert.AreEqual(1, target.Value); 102 | source2.Value = 1; 103 | Assert.AreEqual(2, target.Value); 104 | } 105 | source1.Value = 2; 106 | source2.Value = 2; 107 | // Value should be reseted to 0 108 | Assert.AreEqual(0, target.Value); 109 | } 110 | 111 | [TestMethod] 112 | [ExpectedException(typeof(NullReferenceException))] 113 | public void BindFromExpression_SimpleBinding_WrongInitialValue_ThrowsExeption() 114 | { 115 | var target = new GenericBindingTarget(); 116 | var source = new GenericNotifyPropertyChanged>(); 117 | 118 | BindingEx.BindFromExpression(() => target.Value == source.Value.Value); 119 | } 120 | 121 | [TestMethod] 122 | [ExpectedException(typeof(NullReferenceException))] 123 | public void BindFromExpression_ComplexBinding_WrongInitialValue_ThrowsExeption() 124 | { 125 | var target = new GenericBindingTarget(); 126 | var source1 = new GenericNotifyPropertyChanged(); 127 | var source2 = new GenericNotifyPropertyChanged>(); 128 | 129 | BindingEx.BindFromExpression(() => target.Value == source1.Value + source2.Value.Value); 130 | } 131 | 132 | [TestMethod] 133 | [ExpectedException(typeof(NullReferenceException))] 134 | public void BindFromExpression_SimpleBinding_WrongValueSet_ThrowsExeption() 135 | { 136 | var target = new GenericBindingTarget(); 137 | var source = new GenericNotifyPropertyChanged>(); 138 | source.Value = new GenericNotifyPropertyChanged(); 139 | 140 | BindingEx.BindFromExpression(() => target.Value == source.Value.Value); 141 | 142 | Assert.AreEqual(0, target.Value); 143 | source.Value.Value = 1; 144 | Assert.AreEqual(1, target.Value); 145 | source.Value = null; 146 | } 147 | 148 | [TestMethod] 149 | [ExpectedException(typeof(NullReferenceException))] 150 | public void BindFromExpression_ComplexBinding_WrongValueSet_ThrowsExeption() 151 | { 152 | var target = new GenericBindingTarget(); 153 | var source1 = new GenericNotifyPropertyChanged(); 154 | var source2 = new GenericNotifyPropertyChanged>(); 155 | source2.Value = new GenericNotifyPropertyChanged(); 156 | 157 | BindingEx.BindFromExpression(() => target.Value == source1.Value + source2.Value.Value); 158 | 159 | Assert.AreEqual(0, target.Value); 160 | source1.Value = 1; 161 | Assert.AreEqual(1, target.Value); 162 | source2.Value.Value = 1; 163 | Assert.AreEqual(2, target.Value); 164 | source2.Value = null; 165 | } 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /CodeBinding.Test/CodeBinding.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {31807B71-F1B1-4B19-A049-B60CE2A46B48} 10 | Library 11 | Properties 12 | CodeBinding.Test 13 | CodeBinding.Test 14 | v4.0 15 | 512 16 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 3.5 42 | 43 | 44 | 45 | 46 | 47 | 48 | False 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 60 | CodeBinding 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /CodeBinding.Test/GenericBindingTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | 7 | namespace CodeBinding.Test 8 | { 9 | public class GenericBindingTarget : FrameworkElement 10 | { 11 | public T Value 12 | { 13 | get { return (T)GetValue(ValueProperty); } 14 | set { SetValue(ValueProperty, value); } 15 | } 16 | 17 | public static readonly DependencyProperty ValueProperty = 18 | DependencyProperty.Register("Value", typeof(T), typeof(GenericBindingTarget)); 19 | } 20 | } -------------------------------------------------------------------------------- /CodeBinding.Test/GenericNotifyPropertyChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ComponentModel; 6 | 7 | namespace CodeBinding.Test 8 | { 9 | public class GenericNotifyPropertyChanged : INotifyPropertyChanged 10 | { 11 | public event PropertyChangedEventHandler PropertyChanged; 12 | 13 | private T m_Value; 14 | public T Value 15 | { 16 | get { return m_Value; } 17 | set 18 | { 19 | if ((m_Value==null && value != null) || !m_Value.Equals(value)) 20 | { 21 | m_Value = value; 22 | var handler = PropertyChanged; 23 | if (handler != null) 24 | { 25 | handler(this, new PropertyChangedEventArgs("Value")); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CodeBinding.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodeBinding.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CodeBinding.Test")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("79d55bd8-a536-4a15-bd59-db27bf70bf86")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /CodeBinding.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding", "CodeBinding\CodeBinding.csproj", "{5F5CB969-D0BB-4B5A-8141-1005881E23A8}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding.Rx", "CodeBinding.Rx\CodeBinding.Rx.csproj", "{A83663D3-6899-4E65-AC31-C076AF32197A}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{39DCEC87-E8B5-4B39-B8C6-6A155F564E3B}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserRegistration.Rx", "Samples\UserRegistration.Rx\UserRegistration.Rx.csproj", "{C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleBinding", "Samples\SingleBinding\SingleBinding.csproj", "{0293F500-9354-4996-9780-9E8C550208E7}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding (net35)", "CodeBinding\CodeBinding (net35).csproj", "{F860C2E6-ABA7-4865-B3BA-633DD4985524}" 15 | ProjectSection(ProjectDependencies) = postProject 16 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} = {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 17 | {A83663D3-6899-4E65-AC31-C076AF32197A} = {A83663D3-6899-4E65-AC31-C076AF32197A} 18 | EndProjectSection 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding.Rx (net35)", "CodeBinding.Rx\CodeBinding.Rx (net35).csproj", "{750A8DBF-A6C4-4B2C-8E11-47FC8A285347}" 21 | ProjectSection(ProjectDependencies) = postProject 22 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} = {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 23 | {A83663D3-6899-4E65-AC31-C076AF32197A} = {A83663D3-6899-4E65-AC31-C076AF32197A} 24 | EndProjectSection 25 | EndProject 26 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiBinding", "Samples\MultiBinding\MultiBinding.csproj", "{CE6FB820-220A-4BF0-B3F5-C44F06BDE459}" 27 | EndProject 28 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding.Test", "CodeBinding.Test\CodeBinding.Test.csproj", "{31807B71-F1B1-4B19-A049-B60CE2A46B48}" 29 | EndProject 30 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5B8D0A04-8D11-4623-B88F-BA09C35FF2D8}" 31 | ProjectSection(SolutionItems) = preProject 32 | CodeBinding.vsmdi = CodeBinding.vsmdi 33 | Local.testsettings = Local.testsettings 34 | TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings 35 | EndProjectSection 36 | EndProject 37 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeBinding.Rx.Test", "CodeBinding.Rx.Test\CodeBinding.Rx.Test.csproj", "{C4BB60C9-641A-452D-8D22-5A1340C2EC3A}" 38 | EndProject 39 | Global 40 | GlobalSection(TestCaseManagementSettings) = postSolution 41 | CategoryFile = CodeBinding.vsmdi 42 | EndGlobalSection 43 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 44 | Debug|Any CPU = Debug|Any CPU 45 | Debug|Mixed Platforms = Debug|Mixed Platforms 46 | Debug|x86 = Debug|x86 47 | Release|Any CPU = Release|Any CPU 48 | Release|Mixed Platforms = Release|Mixed Platforms 49 | Release|x86 = Release|x86 50 | EndGlobalSection 51 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 52 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 55 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 56 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Debug|x86.ActiveCfg = Debug|Any CPU 57 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Release|Any CPU.Build.0 = Release|Any CPU 59 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 60 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Release|Mixed Platforms.Build.0 = Release|Any CPU 61 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8}.Release|x86.ActiveCfg = Release|Any CPU 62 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 65 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 66 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Debug|x86.ActiveCfg = Debug|Any CPU 67 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Release|Any CPU.Build.0 = Release|Any CPU 69 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 70 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 71 | {A83663D3-6899-4E65-AC31-C076AF32197A}.Release|x86.ActiveCfg = Release|Any CPU 72 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Debug|Any CPU.ActiveCfg = Debug|x86 73 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 74 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Debug|Mixed Platforms.Build.0 = Debug|x86 75 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Debug|x86.ActiveCfg = Debug|x86 76 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Debug|x86.Build.0 = Debug|x86 77 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Release|Any CPU.ActiveCfg = Release|x86 78 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Release|Mixed Platforms.ActiveCfg = Release|x86 79 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Release|Mixed Platforms.Build.0 = Release|x86 80 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Release|x86.ActiveCfg = Release|x86 81 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5}.Release|x86.Build.0 = Release|x86 82 | {0293F500-9354-4996-9780-9E8C550208E7}.Debug|Any CPU.ActiveCfg = Debug|x86 83 | {0293F500-9354-4996-9780-9E8C550208E7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 84 | {0293F500-9354-4996-9780-9E8C550208E7}.Debug|Mixed Platforms.Build.0 = Debug|x86 85 | {0293F500-9354-4996-9780-9E8C550208E7}.Debug|x86.ActiveCfg = Debug|x86 86 | {0293F500-9354-4996-9780-9E8C550208E7}.Debug|x86.Build.0 = Debug|x86 87 | {0293F500-9354-4996-9780-9E8C550208E7}.Release|Any CPU.ActiveCfg = Release|x86 88 | {0293F500-9354-4996-9780-9E8C550208E7}.Release|Mixed Platforms.ActiveCfg = Release|x86 89 | {0293F500-9354-4996-9780-9E8C550208E7}.Release|Mixed Platforms.Build.0 = Release|x86 90 | {0293F500-9354-4996-9780-9E8C550208E7}.Release|x86.ActiveCfg = Release|x86 91 | {0293F500-9354-4996-9780-9E8C550208E7}.Release|x86.Build.0 = Release|x86 92 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 93 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Debug|Any CPU.Build.0 = Debug|Any CPU 94 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 95 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 96 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Debug|x86.ActiveCfg = Debug|Any CPU 97 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Release|Any CPU.ActiveCfg = Release|Any CPU 98 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Release|Any CPU.Build.0 = Release|Any CPU 99 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 100 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Release|Mixed Platforms.Build.0 = Release|Any CPU 101 | {F860C2E6-ABA7-4865-B3BA-633DD4985524}.Release|x86.ActiveCfg = Release|Any CPU 102 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 103 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Debug|Any CPU.Build.0 = Debug|Any CPU 104 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 105 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 106 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Debug|x86.ActiveCfg = Debug|Any CPU 107 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Release|Any CPU.ActiveCfg = Release|Any CPU 108 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Release|Any CPU.Build.0 = Release|Any CPU 109 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 110 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Release|Mixed Platforms.Build.0 = Release|Any CPU 111 | {750A8DBF-A6C4-4B2C-8E11-47FC8A285347}.Release|x86.ActiveCfg = Release|Any CPU 112 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Debug|Any CPU.ActiveCfg = Debug|x86 113 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 114 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Debug|Mixed Platforms.Build.0 = Debug|x86 115 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Debug|x86.ActiveCfg = Debug|x86 116 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Debug|x86.Build.0 = Debug|x86 117 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Release|Any CPU.ActiveCfg = Release|x86 118 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Release|Mixed Platforms.ActiveCfg = Release|x86 119 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Release|Mixed Platforms.Build.0 = Release|x86 120 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Release|x86.ActiveCfg = Release|x86 121 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459}.Release|x86.Build.0 = Release|x86 122 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 123 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Debug|Any CPU.Build.0 = Debug|Any CPU 124 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 125 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 126 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Debug|x86.ActiveCfg = Debug|Any CPU 127 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Release|Any CPU.ActiveCfg = Release|Any CPU 128 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Release|Any CPU.Build.0 = Release|Any CPU 129 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 130 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Release|Mixed Platforms.Build.0 = Release|Any CPU 131 | {31807B71-F1B1-4B19-A049-B60CE2A46B48}.Release|x86.ActiveCfg = Release|Any CPU 132 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 133 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU 134 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 135 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 136 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Debug|x86.ActiveCfg = Debug|Any CPU 137 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU 138 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Release|Any CPU.Build.0 = Release|Any CPU 139 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 140 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 141 | {C4BB60C9-641A-452D-8D22-5A1340C2EC3A}.Release|x86.ActiveCfg = Release|Any CPU 142 | EndGlobalSection 143 | GlobalSection(SolutionProperties) = preSolution 144 | HideSolutionNode = FALSE 145 | EndGlobalSection 146 | GlobalSection(NestedProjects) = preSolution 147 | {C8EEBF73-599A-436D-BC09-E8B99C9CB5C5} = {39DCEC87-E8B5-4B39-B8C6-6A155F564E3B} 148 | {0293F500-9354-4996-9780-9E8C550208E7} = {39DCEC87-E8B5-4B39-B8C6-6A155F564E3B} 149 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459} = {39DCEC87-E8B5-4B39-B8C6-6A155F564E3B} 150 | EndGlobalSection 151 | EndGlobal 152 | -------------------------------------------------------------------------------- /CodeBinding.vsmdi: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CodeBinding/BindingTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Diagnostics; 7 | using System.Reflection; 8 | using System.Diagnostics.Contracts; 9 | 10 | namespace CodeBinding 11 | { 12 | internal class BindingTarget : FrameworkElement 13 | { 14 | private object m_Target; 15 | private PropertyInfo m_Property; 16 | 17 | public BindingTarget(object target, PropertyInfo property) 18 | { 19 | Contract.Requires(target != null); 20 | Contract.Requires(property != null); 21 | 22 | m_Target = target; 23 | m_Property = property; 24 | } 25 | 26 | public object Value 27 | { 28 | get { return GetValue(ValueProperty); } 29 | set { SetValue(ValueProperty, value); } 30 | } 31 | 32 | public static readonly DependencyProperty ValueProperty = 33 | DependencyProperty.Register("Value", typeof(object), typeof(BindingTarget), new UIPropertyMetadata(OnValueChanged)); 34 | 35 | private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 36 | { 37 | var instance = (BindingTarget)d; 38 | instance.m_Property.SetValue(instance.m_Target, e.NewValue, null); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CodeBinding/ClearBindingDisposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Diagnostics.Contracts; 6 | using System.Windows.Data; 7 | using System.Windows; 8 | 9 | namespace CodeBinding 10 | { 11 | internal class ClearBindingDisposable: IDisposable 12 | { 13 | DependencyObject m_Target; 14 | DependencyProperty m_Property; 15 | BindingBase m_Binding; 16 | 17 | public ClearBindingDisposable(DependencyObject target, DependencyProperty property, BindingBase binding) 18 | { 19 | Contract.Requires(target != null); 20 | Contract.Requires(property != null); 21 | Contract.Requires(binding != null); 22 | 23 | m_Target = target; 24 | m_Property = property; 25 | m_Binding = binding; 26 | } 27 | 28 | public void Dispose() 29 | { 30 | if (m_Target == null) throw new ObjectDisposedException("ClearBindingDisposable"); 31 | if (object.ReferenceEquals(BindingOperations.GetBindingBase(m_Target, m_Property), m_Binding)) 32 | { 33 | BindingOperations.ClearBinding(m_Target, m_Property); 34 | } 35 | m_Target = null; 36 | m_Property = null; 37 | m_Binding = null; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CodeBinding/CodeBinding (net35).csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {F860C2E6-ABA7-4865-B3BA-633DD4985524} 9 | Library 10 | Properties 11 | CodeBinding 12 | CodeBinding 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\bin\net35\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\bin\net35\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /CodeBinding/CodeBinding.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 9 | Library 10 | Properties 11 | CodeBinding 12 | CodeBinding 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\bin\net40\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\bin\net40\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /CodeBinding/CodeBinding.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeBinding 5 | 1.0.0.0 6 | CodeBinding 7 | StanislawSwierc 8 | StanislawSwierc 9 | https://github.com/StanislawSwierc/CodeBinding 10 | false 11 | Create bindings directly from lambda expressions using CodeBinding 12 | Create bindings directly from lambda expressions using CodeBinding 13 | es-US 14 | wpf;binding 15 | 16 | -------------------------------------------------------------------------------- /CodeBinding/ExpressionValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | using System.Diagnostics.Contracts; 7 | using System.Linq.Expressions; 8 | 9 | namespace CodeBinding 10 | { 11 | internal class ExpressionValueConverter : IValueConverter, IMultiValueConverter 12 | { 13 | #region Fields 14 | 15 | private Func m_Func; 16 | private Type m_ReturnType; 17 | 18 | #endregion 19 | 20 | #region Constructors 21 | 22 | /// 23 | /// Basic constructor 24 | /// 25 | /// 26 | /// Expression should be of a form convertible to parameterless 27 | /// lambda body 28 | /// 29 | /// Expression 30 | public ExpressionValueConverter(Expression expression) 31 | { 32 | Contract.Requires(expression != null); 33 | 34 | m_ReturnType = expression.Type; 35 | if (expression.Type != typeof(object)) 36 | { 37 | expression = Expression.Convert(expression, typeof(object)); 38 | } 39 | Expression> lambda = Expression.Lambda>(expression); 40 | m_Func = lambda.Compile(); 41 | } 42 | 43 | #endregion 44 | 45 | #region Methods 46 | 47 | private object Convert(Type targetType) 48 | { 49 | Contract.Requires(targetType != null); 50 | 51 | if (!targetType.IsAssignableFrom(m_ReturnType)) 52 | { 53 | throw new ArgumentException("targetType"); 54 | } 55 | return m_Func.Invoke(); 56 | } 57 | 58 | #endregion 59 | 60 | #region ValueConverter Implementation 61 | 62 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 63 | { 64 | return Convert(targetType); 65 | } 66 | 67 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 68 | { 69 | throw new InvalidOperationException(); 70 | } 71 | 72 | #endregion 73 | 74 | #region IMultiValueConverter Implementation 75 | 76 | /// 77 | /// Invokes inner delegate and returns its result 78 | /// 79 | /// 80 | /// It completely ignores following parameters: values, parameter, culture 81 | /// 82 | /// This parameter is ignored 83 | /// Target type which should be assignable from T 84 | /// This parameter is ignored 85 | /// This parameter is ignored 86 | /// Result of inner delegate invocation 87 | public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) 88 | { 89 | return Convert(targetType); 90 | } 91 | 92 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) 93 | { 94 | throw new NotImplementedException(); 95 | } 96 | 97 | #endregion 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /CodeBinding/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("CodeBinding")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyProduct("CodeBinding")] 10 | 11 | 12 | // Version information for an assembly consists of the following four values: 13 | // 14 | // Major Version 15 | // Minor Version 16 | // Build Number 17 | // Revision 18 | // 19 | // You can specify all the values or you can default the Build and Revision Numbers 20 | // by using the '*' as shown below: 21 | // [assembly: AssemblyVersion("1.0.*")] 22 | [assembly: AssemblyVersion("1.1.1.0")] 23 | [assembly: AssemblyFileVersion("1.1.1.0")] 24 | 25 | 26 | // Make internal visible to other projects from the CodeBinding package 27 | [assembly: InternalsVisibleTo("CodeBinding.Rx")] 28 | -------------------------------------------------------------------------------- /Documentation/Observable Extension API Specification.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanislawSwierc/CodeBinding/d7411f283df660ae02c6fadf31ce40bc89117e5b/Documentation/Observable Extension API Specification.docx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, 4 | you accept this license. If you do not accept the license, do not use the 5 | software. 6 | 7 | 1. Definitions 8 | The terms "reproduce," "reproduction," "derivative works," and "distribution" 9 | have the same meaning here as under U.S. copyright law. A "contribution" is the 10 | original software, or any additions or changes to the software. A "contributor" 11 | is any person that distributes its contribution under this license. "Licensed 12 | patents" are a contributor's patent claims that read directly on its 13 | contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license 18 | conditions and limitations in section 3, each contributor grants you a 19 | non-exclusive, worldwide, royalty-free copyright license to reproduce its 20 | contribution, prepare derivative works of its contribution, and distribute its 21 | contribution or any derivative works that you create. 22 | 23 | (B) Patent Grant- Subject 24 | to the terms of this license, including the license conditions and limitations 25 | in section 3, each contributor grants you a non-exclusive, worldwide, 26 | royalty-free license under its licensed patents to make, have made, use, sell, 27 | offer for sale, import, and/or otherwise dispose of its contribution in the 28 | software or derivative works of the contribution in the software. 29 | 30 | 3. Conditions and Limitations 31 | 32 | (A) No Trademark License- This license does not grant you rights to use any 33 | contributors' name, logo, or trademarks. 34 | (B) If you bring a patent claim against any contributor over patents that you 35 | claim are infringed by the software, your patent license from such contributor 36 | to the software ends automatically. 37 | (C) If you distribute any portion of the software, you must retain all 38 | copyright, patent, trademark, and attribution notices that are present in the 39 | software. 40 | (D) If you distribute any portion of the software in source code form, you may 41 | do so only under this license by including a complete copy of this license with 42 | your distribution. If you distribute any portion of the software in compiled or 43 | object code form, you may only do so under a license that complies with this 44 | license. 45 | (E) The software is licensed "as-is." You bear the risk of using it. The 46 | contributors give no express warranties, guarantees or conditions. You may have 47 | additional consumer rights under your local laws which this license cannot 48 | change. To the extent permitted under your local laws, the contributors exclude 49 | the implied warranties of merchantability, fitness for a particular purpose and 50 | non-infringement. -------------------------------------------------------------------------------- /Local.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are default test settings for a local test run. 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Nuget/CodeBinding.Rx.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeBinding.Rx 5 | 1.1.1.0 6 | CodeBinding.Rx 7 | StanislawSwierc 8 | StanislawSwierc 9 | https://github.com/StanislawSwierc/CodeBinding/blob/master/LICENSE 10 | https://github.com/StanislawSwierc/CodeBinding 11 | false 12 | Create IObservable objects directly from lambda expressions using CodeBinding 13 | Create IObservable objects directly from lambda expressions using CodeBinding 14 | es-US 15 | wpf binding Rx Reactive Observable 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Nuget/CodeBinding.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeBinding 5 | 1.1.1.0 6 | CodeBinding 7 | StanislawSwierc 8 | StanislawSwierc 9 | https://github.com/StanislawSwierc/CodeBinding/blob/master/LICENSE 10 | https://github.com/StanislawSwierc/CodeBinding 11 | false 12 | Create bindings directly from lambda expressions using CodeBinding 13 | Create bindings directly from lambda expressions using CodeBinding 14 | es-US 15 | wpf binding 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CodeBinding 2 | =========== 3 | 4 | 5 | Change log 6 | ---------- 7 | 1.1.1.0 8 | 9 | * Fixed bug related to implicit conversion when binding to enum types 10 | 11 | 1.1.0.0 12 | 13 | * Supported binding to any properties (not DependencyProperties) 14 | * New method 'IDisposable BindingEx.BindFromExpression()' added 15 | * Changed behavior of BindingEx.FromExpression() 16 | * Added test projects 17 | * DelegateConverter and DelegateMultiValueConverter replaced with ExpressionValueConverter 18 | * Improved binding creation engine 19 | * Fixed bug related to not removing multi-bindings correctly 20 | 21 | 1.0.0.0 22 | 23 | * Data Bindings creation from lambda expressions 24 | * Supported binding to DependencyProperties 25 | 26 | 27 | CodeBinding.Rx 28 | ============== 29 | 30 | Change log 31 | ---------- 32 | 33 | 1.1.1.0 34 | 35 | * Updated dependency on CodeBinding 36 | 37 | 1.1.0.0 38 | 39 | * Added test projects 40 | * ObservableEx.FromExpression() renamed to ObservableEx.Create() 41 | * Fixed problem with OnError method not being called when expression throws an exception 42 | 43 | 1.0.0.0 44 | 45 | * IObservable<> object generation from lambda expressions 46 | -------------------------------------------------------------------------------- /Samples/MultiBinding/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/MultiBinding/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace MultiBinding 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/MultiBinding/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Samples/MultiBinding/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | using CodeBinding; 15 | 16 | namespace MultiBinding 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | BindingEx.BindFromExpression(() => result.Text == (1000 * TryParse(arg1.Text, 0) + 100 * TryParse(arg2.Text, 0) + 10 * TryParse(arg3.Text, 0) + TryParse(arg4.Text, 0)).ToString()); 27 | } 28 | 29 | public static int TryParse(string s, int fallback) 30 | { 31 | int result; 32 | if(int.TryParse(s, out result)) 33 | { 34 | return result; 35 | }else 36 | { 37 | return fallback; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Samples/MultiBinding/MultiBinding.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {CE6FB820-220A-4BF0-B3F5-C44F06BDE459} 9 | WinExe 10 | Properties 11 | MultiBinding 12 | MultiBinding 13 | v4.0 14 | Client 15 | 512 16 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 4 18 | 19 | 20 | x86 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | x86 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 4.0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | MSBuild:Compile 56 | Designer 57 | 58 | 59 | MSBuild:Compile 60 | Designer 61 | 62 | 63 | App.xaml 64 | Code 65 | 66 | 67 | MainWindow.xaml 68 | Code 69 | 70 | 71 | 72 | 73 | Code 74 | 75 | 76 | True 77 | True 78 | Resources.resx 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | ResXFileCodeGenerator 87 | Resources.Designer.cs 88 | 89 | 90 | SettingsSingleFileGenerator 91 | Settings.Designer.cs 92 | 93 | 94 | 95 | 96 | 97 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 98 | CodeBinding 99 | 100 | 101 | 102 | 109 | -------------------------------------------------------------------------------- /Samples/MultiBinding/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("MultiBinding")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("MultiBinding")] 15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Samples/MultiBinding/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.431 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MultiBinding.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MultiBinding.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Samples/MultiBinding/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Samples/MultiBinding/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.431 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MultiBinding.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/MultiBinding/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SingleBinding/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/SingleBinding/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace SingleBinding 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/SingleBinding/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Samples/SingleBinding/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | using CodeBinding; 15 | 16 | namespace SingleBinding 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | // Expression has to have \". == \" structure 27 | BindingEx.FromExpression(() => textBox.FontSize == slider.Value); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SingleBinding/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("SingleBinding")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("SingleBinding")] 15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Samples/SingleBinding/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.431 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SingleBinding.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SingleBinding.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Samples/SingleBinding/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Samples/SingleBinding/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.431 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SingleBinding.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SingleBinding/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SingleBinding/SingleBinding.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {0293F500-9354-4996-9780-9E8C550208E7} 9 | WinExe 10 | Properties 11 | SingleBinding 12 | SingleBinding 13 | v4.0 14 | Client 15 | 512 16 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 4 18 | 19 | 20 | x86 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | x86 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 4.0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | MSBuild:Compile 56 | Designer 57 | 58 | 59 | MSBuild:Compile 60 | Designer 61 | 62 | 63 | App.xaml 64 | Code 65 | 66 | 67 | MainWindow.xaml 68 | Code 69 | 70 | 71 | 72 | 73 | Code 74 | 75 | 76 | True 77 | True 78 | Resources.resx 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | ResXFileCodeGenerator 87 | Resources.Designer.cs 88 | 89 | 90 | SettingsSingleFileGenerator 91 | Settings.Designer.cs 92 | 93 | 94 | 95 | 96 | 97 | {5F5CB969-D0BB-4B5A-8141-1005881E23A8} 98 | CodeBinding 99 | 100 | 101 | 102 | 109 | -------------------------------------------------------------------------------- /Samples/UserRegistration.Rx/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/UserRegistration.Rx/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace UserRegistration.Rx 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/UserRegistration.Rx/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 |