private static void EnsureContainer() { //CAS - We have to rebuild the ViewModelRepository everytime when in design mode to ensure we have the correct assemblies if (instance == null || Designer.IsInDesignMode) { instance = new ViewModelRepository(); } }
private static void AttachViewModel(FrameworkElement element, string vmContractName, CreationPolicy policy) { if (element == null) { throw new ArgumentException(InvalidElementForAttachedProperty); } try { if (!String.IsNullOrEmpty(vmContractName)) { ViewModelRepository.AttachViewModelToView(vmContractName, element, policy); } } catch (Exception ex) { Debug.WriteLine("Error while resolving ViewModel. " + ex); } }