1.RiaService
暂时无法显示数据模型传递,只能使用原始的IEnumerable、Dictionary等数据集合类型来代替传递。
http://forums.silverlight.net/forums/p/96425/302186.aspx
2.HyperlinkButton
生成链接按钮后,当点击页面控件后,链接按钮会出现蓝色边框,这时我们只需要将链接按钮设置为:IsTabStop="False"
就ok了
http://forums.silverlight.net/forums/t/40896.aspx
3.DataPager、StoreBoard
用DataPager来实现具有动画效果的control collection的翻页,会让StoreBoard失效
4.Model
在调用Model的视图过程中,下面的条件会出现死循环:
a. 为datagrid绑定某一视图
b.为datagrid的数据源添加selecedchanged事件。
c.通过直接操作表来实现对于视图的更新操作,这里我是弹出一个子窗口对视图进行更新。
Grid:类似于表格布局
Canvas:可以在任意位置显示控件
Stackpanel:以水平或垂直显示控件
WrapPanel:以水平或垂直显示控件,当控件填充完整行或整列时,可自动换行或换列
DockPanel:水平显示控件,使最后一个控件靠边显示
Navigator:导航控件
Frame:框架,与Navigator结合设计系统框架
Border:为控件内容加边框
Rectangle:可做一般的填充区域
ContentControl:内容包含控件
ViewBox:内容包含控件,可设置里面内容的显示效果
Storeboard:故事板,实现动画效果
DataForm:显示数据模型集合,可绑定多个数据模型
DataPager:分页控件,可跟任意容器绑定实现分页效果
最近在跟着 WXWinter 学Workflow,收益非浅。
根据 WXWinter 所提供的关于 会签业务流程 例子,自己也尝试了做一个流程控制,结果在 Persistence 时,出现了一个异常:
{"The execution of the InstancePersistenceCommand named {urn:schemas-
找了半天,最后发现原来是数据库里缺少了System.Activities.DurableInstancing支持。
但这些是什么时候产生的呢?应该会有什么工具可以辅助我们执行相关操作吧。最后在一个老外那找到了一种方式:
如果有其他更好的方式,希望能分享一下
打开命令行,例如输入:
osql -E -S ServerName -d DBName -i C:\Windows\Microsoft.NET\Framework\v4.0.30128\SQL\en\SqlWorkflowInstanceStoreSchema.sql
osql -E -S ServerName -d DBName -i C:\Windows\Microsoft.NET\Framework\v4.0.30128\SQL\en\SqlWorkflowInstanceStoreLogic.sql
完成后,我们再到数据库里查看,就可以看到System.Activities.DurableInstancing的东西了。
当解决这个问题后,运行时,又出现了另一个异常,错误信息如下:
"The execution of an InstancePersistenceCommand was interrupted because the instance '340e56da-3d32-4ca6-9729-2fb5ed19a0cb' is locked by a different instance owner. This error usually occurs because a different host has the instance loaded. The instance owner ID of the owner or host with a lock on the instance is '954d7075-4937-49fe-9213-b2009c6dbcc1'."
还好, WXWinter 已经给出了 答案 ,我们需要将PersistableIdleAction设为PersistableIdleAction.Unload;
前面分别实现了ViewModel与Riaservice,接下来让我们看看如果实现与View的绑定,如下:
ProductionView.xaml的代码如下:
<UserControl x:Class="Mvvm.Client.Views.ProductionView"
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:vm="clr-namespace:Mvvm.Client.ViewModels.ViewModels;assembly=Mvvm.Client.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
<!--添加ProductionViewModel引用-->
<UserControl.Resources>
<vm:ProductionViewModel x:Name="productionViewModel"/>
</UserControl.Resources>
<!--通过DataContext与Grid绑定-->
<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource productionViewModel}}" MinHeight="100">
<!--添加GdataGrid与DataPager控件-->
<data:DataGrid AutoGenerateColumns="True" Name="dataGrid1" MinHeight="20" MinWidth="100" Grid.Row="4" />
<data:DataPager Grid.Row="5" Name="dataPager1" />
</Grid>
</UserControl>
在这里,控件与数据源的绑定放在了其*.cs文件中,这样更方便于我们进行相关操作,代码如下:
public partial class ProductionView : UserControl
{
public ProductionView()
{
InitializeComponent();
BindingGrid();
}
void BindingGrid()
{
this.productionViewModel = new ViewModels.ViewModels.ProductionViewModel();
base.DataContext = this.productionViewModel;
this.productionViewModel.QueryCommand.Execute(null);
// Wrap the itemList in a PagedCollectionView for paging functionality
PagedCollectionView itemListView = new PagedCollectionView(this.productionViewModel.ListProduction);
if (itemListView != null)
{
dataGrid1.ItemsSource = itemListView;
dataPager1.Source = itemListView;
dataPager1.PageSize = 20;
dataPager1.DataContext = this.dataPager1;
}
}
}
这样,我们就能够将View与ViewModel关联起来。
以MVVM这么模式来设计开发Silverlight,真正意义上达到了我们要实现页面与逻辑分离的目的。上面例子中,我们的View也可以用WPF来实现。