随笔分类 -  SilverLight

Silverlight 拖动复制控件
摘要:Silverlight 拖动复制控件,就是将控件从一个容器中向另一个容器中拖动时,不是移动控件而把该控件到另一个容器中。这种情形在程序中经常遇到,下面是我做的一个拖动复制控件的示例,仅供有这种需求的朋友们参考。 新建一个 Silverlight 项目命名为 DragAndCopy ,在新建的项目中添加一个Silverlight 用户控件(Silverlight user control)命名为 DragObject。项目结构如下图所示: 其中 DragObject 就是要拖动的用户控件,DragObject 的 Xaml 代码如下:<UserControl x:Class="D 阅读全文

posted @ 2012-07-03 22:54 项目管理之家 阅读(608) 评论(0) 推荐(0)

C#实现简单的拖动功能
摘要:这个例子是将系统文件或目录拖动到窗体中,窗体以MessageBox的形式弹出用户拖入的文件或目录名称。首先需要将要支持拖动的Form的AllowDrop=true;然后通过DragEnter和DragDrop事件即可,具体代码如下: 1 private void Form1_DragDrop(object sender, DragEventArgs e) 2 { 3 System.Array datas = (System.Array)e.Data.GetData(DataFormats.FileDrop); 4 string ... 阅读全文

posted @ 2012-07-03 22:51 项目管理之家 阅读(392) 评论(0) 推荐(0)

Silverlight 开源项目分析Live Geometry CTP 2(2)项目框架分析
摘要:Silverlight 开源项目分析Live Geometry CTP 2(2)项目框架分析在线地址:http://geometry.osenkov.com源码地址:http://livegeometry.codeplex.com/没看懂Live Geometry只好自己摸索了。大气象<UserControlx:Class="SilverlightUndo.DrawDrag"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://sc 阅读全文

posted @ 2012-07-03 22:43 项目管理之家 阅读(515) 评论(0) 推荐(0)

Silverlight对象拖动总结
摘要:Silverlight对象拖动总结 在Silverlight中,要实现拖动对象的功能最简单的方式是采用Canvas做为父容器,通过动态的改变元素的附加属性Top、Left即可实现拖动同能。如图所示:下例所示: XAML:<UserControl x:Class="DragExample.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xam 阅读全文

posted @ 2012-07-03 22:40 项目管理之家 阅读(1347) 评论(0) 推荐(0)

MVVM之OneTime,OneWay,TwoWay的区别和作用
摘要:1:数据源--》控件 的更改就只能用OneWay,TwoWay并且需要实现INotifyPropertyChanged接口2:控件---》数据源,只有使用TwoWay 方式才可以修改数据源(且不需要实现INotifyPropertyChanged接口)。然而直接更改控件值,虽然这样能更改控件Text属性值,但要 进行类型转换,在这里都要转换为字符串类型。所以我们在操作是常用实体来接收参数,而不是直接去控件的值!3:OneTime 只用来初始化数据,但不能有控件更新数据源,也不能有数据源更新控件!4:控件默认的Mode方式应该是OneWay ,如果VM实现了INotifyPropertyChan 阅读全文

posted @ 2012-03-22 22:00 项目管理之家 阅读(1775) 评论(0) 推荐(2)

JohnSon:SilverLight详细表单信息
摘要:<!--第一行--> <Border BorderBrush="#C7DAE9" BorderThickness="1" Grid.Column="0" Grid.Row="0" Padding="0,0,5,0"> <TextBlock Text="姓名:" Style="{StaticResource TextBlockInfo}"/> </Border> <Border BorderBrush=& 阅读全文

posted @ 2012-03-05 23:14 项目管理之家 阅读(183) 评论(0) 推荐(0)

JohnSon:通过反射获取UserControl
摘要:private UserControl CreatePanel(string panelName) { if (panelName != string.Empty) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); foreach (Type type in executingAssembly.GetTypes()) { if (type.Name.EndsWith(panelName)) { UserControl panel = Activator.CreateInstance(type) as UserCont 阅读全文

posted @ 2012-03-05 22:57 项目管理之家 阅读(164) 评论(0) 推荐(0)

导航