MVVM Light
摘要: <TreeView x:Name="treeview1" ItemsSource="{Binding TreeData}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}"> <TextBlock Text="{Binding NodeName}"/> </HierarchicalDataTemplate> </TreeView.It阅读全文
摘要: <ListBox ItemsSource="{Binding Provinces}" DisplayMemberPath="ProvinceName"/> ListBox其实有一个默认的ItemTemplate,它以一个Content控件来显示DisplayMemberPath定义的字段的内容,我们可以自定义ItemTemplate让ListBox显示更多的内容,注意ItemTemplate与DisplayMemberPath不能同时定义 <ListBox ItemsSource="{Binding Provinces}&qu阅读全文
摘要: <ButtonContent="按钮"Command="{BindingButtonCommand}"/> // 按钮点击命令 public ICommand ButtonCommand { get { return new RelayCommand( () => System.Windows.MessageBox.Show("当前时间:" + System.DateTime.Now.ToString()) ); } }阅读全文
摘要: 一个 Silverlight 一般只有一个 ViewModelLocator 。如果是通过MVVM 模板建立的项目,默认就有该文件了。用到的Code Snape : mvvmlocatorproperty。App.Xaml,先添加ViewModel命名控件引用,然后为ViewModelLocator添加一个全局的资源 <Application.Resources> <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /> </Application.Resou阅读全文
摘要: 在Visual Studio中,选择工具 / 代码段管理器/ My Code Snippetss 找出My Code Snippetss 的路径。将 Mvvm Light 代码段 的文件复制到 My Code Snippetss 中。Mvvm Light 代码段 默认在C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Snippets\CSharp阅读全文
摘要: duanzilin的博客 http://blog.csdn.net/duanzilin/article/details/6387639阅读全文