Executing UI Code from ViewModel on MVVMCross

后端 未结 2 1686
北荒
北荒 2020-12-14 13:27

I have just started using MvvmCross, but i didn\'t find any info about to how i can execute UI code from a ViewModel.

On Caliburn there are coroutine so i can acces

2条回答
  •  -上瘾入骨i
    2020-12-14 13:50

    There exists an easier way. Here is the method I use for executing any action on the main thread:

    protected void RunOnUIThread(Action action) {
        var dispatcher = Mvx.Resolve();
        dispatcher.RequestMainThreadAction(action);
    }
    

    Hope it helps. Cheers.

提交回复
热议问题