WPF界面的复合使用
<!-- **************************************************************** * 作 者 :姜 彦 * 项目名称 :EMRCPOE.Presentation.EMR.View * 控件名称 :UCInHospPatientCPOE * 命名空间 :EMRCPOE.Presentation.EMR.View * CLR 版本 :4.0.30319.42000 * 创建时间 :2020/2/24 10:51:41 * 当前版本 :1.0.0.0 * WeChatQQ :771078740 * My Email :jiangyan2008.521@gmail.com * jiangyan2008.521@qq.com * 描述说明 :住院医嘱汇总界面 * * 修改历史 : * **************************************************************** * Copyright @ JiangYan 2020 All rights reserved **************************************************************** --> <UserControl x:Class="EMRCPOE.Presentation.EMR.View.UCInHospPatientCPOE" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:EMRCPOE.Presentation.EMR.View" xmlns:vm="clr-namespace:EMRCPOE.Presentation.EMR.ViewModel" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <!--<UserControl.Resources> <vm:InHospPatientCPOEViewModel x:Key="VM" /> </UserControl.Resources> <UserControl.DataContext> <Binding Source="{StaticResource VM}" /> </UserControl.DataContext>--> <Grid> <TabControl> <TabItem Header="长期医嘱" IsSelected="{Binding IsSelectedLong,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <local:UCInHospPatientCPOELong DataContext="{Binding DataContext.DataContextLong, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"/> </TabItem> <TabItem Header="临时医嘱" IsSelected="{Binding IsSelectedStat,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <local:UCInHospPatientCPOEStat DataContext="{Binding DataContext.DataContextStat, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"/> </TabItem> <TabItem Header="当前录入医嘱" IsSelected="{Binding IsSelectedCurrent,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <local:UCInHospPatientCPOECurrent DataContext="{Binding DataContext.DataContextCurrent, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" /> </TabItem> </TabControl> </Grid> </UserControl> <!-- ******************************************************************* * 备 注 : * * * ******************************************************************* * Copyright @ JiangYan 2020. All rights reserved. ******************************************************************* -->
/*---------------------------------------------------------------- * 作 者 :姜 彦 * 项目名称 :EMRCPOE.Presentation.EMR.ViewModel * 类 名 称 :InHospPatientCPOEViewModel * 命名空间 :EMRCPOE.Presentation.EMR.ViewModel * CLR 版本 :4.0.30319.42000 * 创建时间 :2020/2/24 10:52:18 * 当前版本 :1.0.0.0 * WeChatQQ :771078740 * My Email :jiangyan2008.521@gmail.com * jiangyan2008.521@qq.com * 描述说明 :住院医嘱汇总界面VM * * 修改历史 : * ******************************************************************* * Copyright @ JiangYan 2020. All rights reserved. ******************************************************************* ------------------------------------------------------------------*/ using EMRCPOE.Presentation.Model.EMR; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Util.Dependency; using Util.Helpers; namespace EMRCPOE.Presentation.EMR.ViewModel { /// <summary> /// InHospPatientCPOEViewModel /// </summary> public class InHospPatientCPOEViewModel : PatientViewModelBase, ITransientDependency { #region Construction /// <summary> /// 构造函数 /// </summary> public InHospPatientCPOEViewModel() { } /// <summary> /// 构造函数 /// </summary> public InHospPatientCPOEViewModel(object obj) { } #endregion #region Field #endregion Field #region Property #region 当前住院病人对象/CurrentInHospPatientVisitModel /// <summary> /// 当前住院病人对象 /// </summary> private InHospPatientVisitModel _currentInHospPatientVisitModel = new InHospPatientVisitModel(); /// <summary> /// 当前住院病人对象 /// </summary> public InHospPatientVisitModel CurrentInHospPatientVisitModel { get { return _currentInHospPatientVisitModel; } set { if (_currentInHospPatientVisitModel != value) { _currentInHospPatientVisitModel = value; if (_isSelectedCurrent) { var vm = Ioc.Create<InHospPatientCPOECurrentViewModel>(); vm.CurrentInHospPatientVisitModel = CurrentInHospPatientVisitModel.Clone; DataContextCurrent = vm; } if (PropertyChangedHandler != null) { RaisePropertyChanged(() => CurrentInHospPatientVisitModel); } } } } #endregion 当前住院病人对象/CurrentInHospPatientVisitModel #region 是否选中当前医嘱/IsSelectedCurrent /// <summary> /// 是否选中当前医嘱 /// </summary> private bool _isSelectedCurrent=true; /// <summary> /// 是否选中当前医嘱 /// </summary> public bool IsSelectedCurrent { get { return _isSelectedCurrent; } set { if (_isSelectedCurrent != value) { _isSelectedCurrent = value; if (value) { var vm = Ioc.Create<InHospPatientCPOECurrentViewModel>(); vm.CurrentInHospPatientVisitModel = CurrentInHospPatientVisitModel.Clone; DataContextCurrent = vm; } if (PropertyChangedHandler != null) { RaisePropertyChanged(() => IsSelectedCurrent); } } } } #endregion 是否选中当前医嘱/IsSelectedCurrent #region 是否选中长期医嘱/IsSelectedLong /// <summary> /// 是否选中长期医嘱 /// </summary> private bool _isSelectedLong; /// <summary> /// 是否选中长期医嘱 /// </summary> public bool IsSelectedLong { get { return _isSelectedLong; } set { if (_isSelectedLong != value) { _isSelectedLong = value; if (value) { var vm = Ioc.Create<InHospPatientCPOELongViewModel>(); vm.CurrentInHospPatientVisitModel = CurrentInHospPatientVisitModel.Clone; DataContextLong = vm; } if (PropertyChangedHandler != null) { RaisePropertyChanged(() => IsSelectedLong); } } } } #endregion 是否选中长期医嘱/IsSelectedLong #region 是否选中临时医嘱/IsSelectedStat /// <summary> /// 是否选中临时医嘱 /// </summary> private bool _isSelectedStat; /// <summary> /// 是否选中临时医嘱 /// </summary> public bool IsSelectedStat { get { return _isSelectedStat; } set { if (_isSelectedStat != value) { _isSelectedStat = value; if (value) { var vm = Ioc.Create<InHospPatientCPOEStatViewModel>(); vm.CurrentInHospPatientVisitModel = CurrentInHospPatientVisitModel.Clone; DataContextStat = vm; } if (PropertyChangedHandler != null) { RaisePropertyChanged(() => IsSelectedStat); } } } } #endregion 是否选中临时医嘱/IsSelectedStat #region 当前医嘱/DataContextCurrent /// <summary> /// 当前医嘱 /// </summary> private object _dataContextCurrent=new object(); /// <summary> /// 当前医嘱 /// </summary> public object DataContextCurrent { get { return _dataContextCurrent; } set { if (_dataContextCurrent != value) { _dataContextCurrent = value; if (PropertyChangedHandler != null) { RaisePropertyChanged(() => DataContextCurrent); } } } } #endregion 当前医嘱/DataContextCurrent #region 长期医嘱/DataContextLong /// <summary> /// 长期医嘱 /// </summary> private object _dataContextLong=new object(); /// <summary> /// 长期医嘱 /// </summary> public object DataContextLong { get { return _dataContextLong; } set { if (_dataContextLong != value) { _dataContextLong = value; if (PropertyChangedHandler != null) { RaisePropertyChanged(() => DataContextLong); } } } } #endregion 长期医嘱/DataContextLong #region 临时医嘱/DataContextStat /// <summary> /// 临时医嘱 /// </summary> private object _dataContextStat=new object(); /// <summary> /// 临时医嘱 /// </summary> public object DataContextStat { get { return _dataContextStat; } set { if (_dataContextStat != value) { _dataContextStat = value; if (PropertyChangedHandler != null) { RaisePropertyChanged(() => DataContextStat); } } } } #endregion 临时医嘱/DataContextStat #endregion Property #region Command #region Command #endregion Command #region ExecuteCommand #endregion ExecuteCommand #endregion Command #region Function #endregion Function } } /*---------------------------------------------------------------- * 备 注 : * * * ******************************************************************* * Copyright @ JiangYan 2020. All rights reserved. ******************************************************************* ------------------------------------------------------------------*/

您的资助是我最大的动力!
金额随意,欢迎来赏!

我写的东西能让你能懂,那是义务
毕竟占用了你生命中的宝贵的时间和注意力
要是你还能喜欢我的作品,那就是缘分了
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的因为,我的写作热情也离不开您的肯定支持,感谢您的阅读,我是【青青子衿】!