【发布时间】:2019-03-13 12:58:54
【问题描述】:
我有Page.xaml
<Page>
<Page.DataContext>
<vm:ExcelViewModel />
</Page.DataContext>
<Grid>
<Button Command="{Binding Path=CopyCommand}" Margin="5"/>
</Grid>
</Page>
这是我的ExcelViewModel.cs
public ExcelViewModel()
{
SourcePath = @"\\test\\2019";
}
private readonly IExcelService fileService;
public ICommand CopyCommand{ get; private set; }
public ExcelViewModel(IExcelService fileService)
{
this.fileService = fileService;
CopyCommand= new RelayCommand(CopyExcel);
}
但是当我尝试运行“CopyExcel”时,什么也没有发生。
我做错了什么?
【问题讨论】:
标签: c# wpf xaml command relaycommand