Created
November 7, 2012 11:48
-
-
Save patroza/4031046 to your computer and use it in GitHub Desktop.
Initialize First RXUI Object on UI Thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Workaround for RXUi, first object initialization must be on UI Thread | |
| private class DummyModel : BindableBase | |
| { | |
| private ObservableAsPropertyHelper<string> _propertyHelper; | |
| public string PropertyHelper | |
| { | |
| get { return _propertyHelper.Value; } | |
| } | |
| private string _Name; | |
| public string Name | |
| { | |
| get { return _Name; } | |
| set { SetProperty(ref _Name, value); } | |
| } | |
| public DummyModel() | |
| { | |
| this.WhenAny(x => x.Name, x => x.Value) | |
| .Select(x => x) | |
| .ToProperty(this, x => x.PropertyHelper); | |
| } | |
| } | |
| public static void InitializeRx() | |
| { | |
| Execute.OnUiThread( | |
| () => | |
| { | |
| // Create new model instance and Trigger INPC | |
| var model = new DummyModel() { Name = "a Name" }; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment