我目前正在试验Expression Blend 3 MIX09 version,想法是 use it primarily for an MVVM structured site with databinding, being able to view live data as I design . 到目前为止,我已经 very impressed 并且不得不说 Blend 3's generated XAML is not as bad as people say it is . 我得到了以下两个例子,一个是数据绑定,另一个是动态加载的用户控件(视图) . 在设计我的应用程序时,我可以在90%的时间内保持Expression Blend,在设计时看到来自我的ViewModel的实时数据 . 我只切换到Visual Studio,例如创建配置文件或添加引用更容易 . improved intellisense of Blend 3 使我能够在Blend中保留大部分编码:
-
MVVM base application that can be edited with Expression Blend and Visual Studio
-
How to structure a WPF application with DataBinding so you can enhance it in Expression Blend
但是,我在Expression Blend中做的一件事是,在我创建了一个ListBox之后,我希望我可以右键单击 create a DataTemplate . 我当然可以在代码中创建一个DataTemplate,然后在Resources / Window下我再次找到它,可以单击它旁边的按钮"go into the DataTemplate"并在我的Objects和Timeline面板中查看控件,这很不错 . 但是从控件创建一个DataTemplate是如此常见,我认为有一种方法可以实现,我只是缺少 .
Where in Blend 3 can you "create a DataTemplate" for a ListBox or ListView, etc?
<UserControl
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"
xmlns:local="clr-namespace:TestDynamic456"
mc:Ignorable="d"
x:Class="TestDynamic456.CustomersView"
x:Name="UserControl"
d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources>
<local:CustomersViewModel x:Key="CustomersDataProvider"/>
</UserControl.Resources>
<StackPanel x:Name="LayoutRoot" Background="{x:Null}">
<ListBox ItemsSource="{Binding Path=GetAll, Source={StaticResource CustomersDataProvider}}"/>
</StackPanel>
</UserControl>
1 回答
在Blend 3中,您可以在Blend2中为ItemsControl创建一个DataTemplate;)
右键单击控件 - >编辑其他模板 - >编辑生成的项目(ItemTemplate) - > CreateEmpty