在c#中等效于xaml以下

时间:2014-11-21 11:39:05

标签: c# wpf xaml

我的Infrastructure项目中有一个名为NavigateCommand的CompositeCommand。我使用下面提到的XAML将参数传递给方法:

Command="{x:Static inf:ApplicationCommands.NavigateCommand}" 
CommandParameter="{Binding ListSourcePage}"

现在,我想用C#做同样的事情。我该怎么办?

1 个答案:

答案 0 :(得分:2)

假设下面的代码在类中,其中声明了ListSourcePage属性:

if (ApplicationCommands.NavigateCommand.CanExecute(ListSourcePage))
{
    ApplicationCommands.NavigateCommand.Execute(ListSourcePage);
}