1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using FWindSoft.Wpf;
- using FWindSoft.Wpf.Controls;
- namespace FWindSoft.MVVM
- {
- /// <summary>
- /// 基础视图
- /// </summary>
- public static class BaseViewModelExtension
- {
- public static Window GetWindow(this BaseViewModel vm)
- {
- var refView = vm.GetRefView();
- if (refView == null)
- return null;
- return refView.GetParentTypeSelf<Window>();
- ;
- }
- public static NavigationBar GetNavigationBar(this BaseViewModel vm)
- {
- var refView = vm.GetRefView();
- if (refView == null)
- return null;
- return refView.GetParentType<NavigationBar>();
- }
- }
- }
|