SimpleIoc.Default.Register fails at IsInDesignModeStatic if the Interface is in different assembly

前端 未结 1 949
后悔当初
后悔当初 2020-12-21 09:22

In the static constructor of ViewModelLocator class the SimpleIoc.Default.Register(); fails at IsInDesignModeStatic mode, if

1条回答
  •  无人及你
    2020-12-21 10:15

        if (ViewModelBase.IsInDesignModeStatic) {
    
    
            // put these lines here:
            if (SimpleIoc.Default.IsRegistered()) {
                SimpleIoc.Default.Unregister();
            }
    
            SimpleIoc.Default.Register();
        }
        else {
            SimpleIoc.Default.Register();
        }
    

    0 讨论(0)
提交回复
热议问题