c# - Showing a progress dialog when loading a View/UserControl using MVVM: Which events should I use? -
i want show loading dialog while opening view
/usercontrol
takes while open. know can use loaded
event close dialog once ui laid out , shown. doing in sample code shown below.
my question is: there event can use in similar manner open dialog when layout/loading process starts?
i open loading dialog viewmodel
opens view
/usercontrol
, spread out logic. furthermore, since using messaging (from mvvmlight) signal view
/usercontrol
load result in unclean solution imo. ideas how achieve this?
view:
<i:interaction.triggers> <i:eventtrigger eventname="loaded"> <i:invokecommandaction command="{binding viewloadedeventhandlercommand}" /> </i:eventtrigger> </i:interaction.triggers>
viewmodel:
private icommand viewloadedeventhandlercommand; public icommand viewloadedeventhandlercommand { { if (viewloadedeventhandlercommand == null) viewloadedeventhandlercommand = new relaycommand(() => debug.writeline("mainview loaded.")); return viewloadedeventhandlercommand; } }
Comments
Post a Comment