私はCMのチュートリアルを開始しており、最後の例はhereです。私はCMでできることをより良く感じるために、wpfプロジェクトで通常行ういくつかのことを行いました.ViewのフォルダとViewModelsのフォルダを作成しました。大会ではまだすべてが見つかるはずです。caliburnマイクロチュートリアルの問題
他のすべての例はこのようにうまく機能しますが、CMとSilverlightのデバッグ方法については無知ですが、私はデータコンテキストの問題と思われるものを説明しません。 。
誰かが問題を見つけることができますか?
乾杯、
Berryl
VM
[Export(typeof(IShell))]
public class ShellWithCompositionViewModel : PropertyChangedBase
{
public BindableCollection<Model> Items { get; private set; }
public ShellWithCompositionViewModel() {
Items = new BindableCollection<Model>
{
new Model {Id = Guid.NewGuid()},
new Model {Id = Guid.NewGuid()},
new Model {Id = Guid.NewGuid()},
new Model {Id = Guid.NewGuid()}
};
}
public void Add() { Items.Add(new Model {Id = Guid.NewGuid()}); }
public void Remove(Model child) { Items.Remove(child); }
}
VIEW
<UserControl x:Class="Caliburn.Micro.Hello.Views.ShellWithCompositionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
>
<StackPanel>
<ItemsControl x:Name="Items">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Content="Remove" cal:Message.Attach="Remove($dataContext)" />
<TextBlock Text="{Binding Id}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="Add" cal:Message.Attach="Add" />
</StackPanel>
BOOT
namespace Caliburn.Micro.Hello
{
//public class HelloBootstrapper : Bootstrapper<ShellViewModel> { }
//public class HelloBootstrapper : Bootstrapper<ShellWithParametersViewModel> { }
public class HelloBootstrapper : Bootstrapper<ShellWithCompositionView> { }
}
FIX
// left off the model the 1st time (caps not needed!)
public class HelloBootstrapper : Bootstrapper<ShellWithCompositionViewMODEL> { }
Duh ...これは実際には簡単で確かにCMの問題ではありません。 Bootstrapperに手掛かりがあり、誰かが素早い回答を望むなら。 – Berryl