摘要: 使用MVVM模式开发silverlight程序时,Command命令一般定义在VM中.1. 使用DataContext代理类. public class DataContextProxy : DependencyObject { public static readonly DependencyProperty DataContextProperty = DependencyProperty.Register( "DataContext", typeof(object), typeof(DataContextProxy), new PropertyMetadata(null 阅读全文
posted @ 2011-11-29 13:42 ysxiaodong 阅读(580) 评论(0) 推荐(0)
摘要: 1. 定义controlTemplate <ControlTemplate TargetType="Button" x:Key="deleteButtonStyle"> <ContentPresenter> <Image Width="20" Stretch="Fill" Name="Delete" Source="images/Delete.png"/> </ContentPresenter> </ControlTemp 阅读全文
posted @ 2011-11-29 13:35 ysxiaodong 阅读(214) 评论(0) 推荐(0)
摘要: HTML页面引用silverlight object部分:1. 定义JS方法function changeHeight(h) { $("#xxx").height(h); }2. SL部分 System.Windows.Browser.HtmlPage.Window.Invoke("InvokePlayer", this.LayoutRoot.Height); 阅读全文
posted @ 2011-11-27 21:54 ysxiaodong 阅读(154) 评论(0) 推荐(0)
摘要: HTML部分:1. <param name="enableHtmlAccess" value="true" />2. function test() { var silverlight1 = document.getElementById('xxx'); silverlight1.Content.silverlightPage.Process("lxd"); // xxx是<object>对象的id,silverlightPage 是将silverlight部分注册到HTML中的key,Proc 阅读全文
posted @ 2011-11-27 21:45 ysxiaodong 阅读(190) 评论(0) 推荐(0)