我正在尝试使用 Caliburn 和以下代码绑定组合框:
yyyView.xaml
<ComboBox x:Name="Filters"></ComboBox>
yyyViewModel.xaml
private string selectedFilter;
public BindableCollection<string> Filters
{
get
{
return new BindableCollection<string>(
new string[]{ "All", "Last Month", "Last Week", "Yesterday" });
}
}
public string SelectedFilter
{
get { return selectedFilter; }
set
{
selectedFilter = value;
NotifyOfPropertyChange(() => SelectedFilter);
}
}
使用此代码,我在GetInstance方法的App.xaml.cs上收到ArgumentNullException 。
我是 MVVM、Caliburn 和 XAML 的新手,但我在某处读过WinRT 开发中的某些行为(我相信Blend Behaviors )。
那是问题吗?我该如何解决这个问题?
谢谢
编辑:
应用程序.xaml.cs
protected override void Configure()
{
LogManager.GetLog = type => new DebugLogger(type);
container = new WinRTContainer();
container.RegisterWinRTServices();
container.PerRequest<aaaViewModel>();
container.PerRequest<xxxViewModel>();
container.PerRequest<yyyViewModel>();
container.PerRequest<zzzViewModel>();
}
应用程序.xaml
<caliburn:CaliburnApplication
x:Class="yyyStoreApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:yyyApp"
xmlns:caliburn="using:Caliburn.Micro"
xmlns:converters="using:yyyApp.Converters"
RequestedTheme="Light">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/CustomStyles.xaml" />
<ResourceDictionary Source="Resources/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<converters:ImageFilePathConverter x:Key="ImageFilePath"/>
</ResourceDictionary>
</Application.Resources>
</caliburn:CaliburnApplication>