110,534
社区成员
发帖
与我相关
我的任务
分享
<Window.Resources>
<v:VMMainWindow x:Key="MainViewModel" />
<DataTemplate DataType="{x:Type v:VMNumberArea}">
<c:NumberArea />
</DataTemplate>
<DataTemplate DataType="{x:Type v:VMQueryPayListCtrl}">
<c:QueryPayListCtrl/>
</DataTemplate>
<DataTemplate DataType="{x:Type v:VMRefundCtrl}">
<c:RefundCtrl/>
</DataTemplate>
</Window.Resources>
<Grid DataContext="{StaticResource MainViewModel}">
<ContentControl x:Name="workArea" Background="White" Content="{Binding ViewModel}" HorizontalAlignment="Left" Height="{Binding Wheight}" Width="850" Grid.Row="2" VerticalAlignment="Top"/>
<UserCtrl:ShadeCtrl Tag="查询" HorizontalAlignment="Left" Grid.Row="0" VerticalAlignment="Top" Height="85" Margin="131,0,0,0" Width="58">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding TextBlockCommand}" CommandParameter="查询" />
</i:EventTrigger>
</i:Interaction.Triggers>
</UserCtrl:ShadeCtrl>
<UserCtrl:ShadeCtrl Tag="退款" HorizontalAlignment="Left" Grid.Row="0" VerticalAlignment="Top" Height="85" Margin="63,0,0,0" Width="68" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding TextBlockCommand}" CommandParameter="退款" />
</i:EventTrigger>
</i:Interaction.Triggers>
</UserCtrl:ShadeCtrl>
private readonly VMNumberArea _vMNumberArea = new VMNumberArea();
private readonly VMQueryPayListCtrl _vMQueryPayListCtrl = new VMQueryPayListCtrl();
private readonly VMRefundCtrl _vMRefundCtrl = new VMRefundCtrl();
private object _viewModel;
public object ViewModel
{
get { return _viewModel; }
set
{
if (_viewModel == value)
{
return;
}
_viewModel = value;
OnPropertyChanged("ViewModel");
}
}
public DelegateCommand TextBlockCommand { get; set; }
public VMMainWindow()
{
this.TextBlockCommand = new DelegateCommand();
this.TextBlockCommand.ExecuteAction = new Action<object>(ShowTextBlock);
}
private void ShowTextBlock(object obj)
{
switch (obj.ToString())
{
case "收款":
Receivables();
break;
case "退款":
Refund();
break;
case "查询":
Query();
break;
case "统计":
Statistics();
break;
case "解绑":
Untying();
break;
case "设置":
Setup();
break;
case "账户":
Account();
break;
case "退出":
default:
Closed?.Invoke();
break;
}
}
private void Query()
{
Height = new GridLength(0);
Wheight = 475;
ViewModel = _vMQueryPayListCtrl;
}
private void Refund()
{
ViewModel = new VMRefundCtrl();
}