Caliburn.Micro是否支持設計時間數據? 我嘗試了以下步驟; 我創建了一個簡單的hello世界程序。 ShellViewModel從IShell派生而來。通過運行示例程序,它可以在運行時顯示問候語。由於視圖模型是從IShell衍生而來的,因此我創建了一個衍生自IShell的虛擬類,並將其用作設計時間實例。Caliburn.Micro是否支持設計時間數據?
public class SampleShellViewModel:IShell
{
#region IShell Members
public string HelloWorld
{
get { return "Hello World"; }
}
#endregion
}
在我添加了設計時的上下文如下
<UserControl x:Class="HelloWorld.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:sampleData="clr-namespace:HelloWorld"
d:DesignHeight="287" d:DesignWidth="518"
>
<Grid Background="White" d:DataContext="{d:DesignInstance sampleData:SampleShellViewModel, IsDesignTimeCreatable=True}">
<TextBlock Name="HelloWorld"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="20" />
</Grid>
認爲
有什麼我失蹤? 謝謝
它。看起來完整,$ 10000的問題是,它是否適合你? –
不,它不適用於我。 – Nair
好吧你的d:DataContext =「等等...代碼是完美的你仍然需要Text = {綁定你好World}混合來訪問數據(Id完全隱藏在查看該部分),Blend不通過Caliburn約定活頁夾運行xaml。它需要明確設置。 –