1
我使用棱镜来建立一个WPF应用程序,但有一些麻烦让以下工作。我在Shell.xaml
文件中有一个Storyboard
。故事板应该由区域中的用户控件中的按钮触发。我Shell.xaml
看起来是这样的:在棱镜壳启动故事板基于按钮点击区域内
<Window ...>
<Window.Resources>
<ResourceDictionary>
<Storyboard x:Key="myStoryboard">...</Storyboard>
</ResourceDictionary>
</Window.Resources>
<ContentControl x:Name="wizard" prism:RegionManager.RegionName="MyRegion" />
</Window>
按钮连接到视图模型的命令。注入到该区域MyRegion
用户控件看起来是这样的:
<UserControl ...>
<Button x:Name="myButton" Command="{Binding WizardCommand}">
MyButton
</Button>
</UserControl>
最后对应于以前的用户控制视图模型:
[Export(typeof(MyViewModel))]
public class MyViewModel
{
private readonly DelegateCommand _wizardCommand;
public ICommand WizardCommand { get { return _wizardCommand; } }
public MyViewModel()
{
_wizardCommand = new DelegateCommand(StartWizard);
}
private void StartWizard()
{
??????
}
}
我应该采取什么步骤来运行的故事板myStoryboard
内Shell.xaml
从WizardCommand
区域内MyRegion
。
我得到它的工作。谢谢! – 2012-01-11 14:35:31