Skip to content

Instantly share code, notes, and snippets.

@patroza
Created November 7, 2012 11:48
Show Gist options
  • Select an option

  • Save patroza/4031046 to your computer and use it in GitHub Desktop.

Select an option

Save patroza/4031046 to your computer and use it in GitHub Desktop.
Initialize First RXUI Object on UI Thread
// 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