摘要:
1、设置源控件和目标控件的AllowDrop=truelistBox1.AllowDrop = true;<Style TargetType="ListBoxItem"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <StackPanel Name="grid"> <Image Source="{Binding}"/> <TextBlock Text= 阅读全文
阅读排行榜
Wpf实现打印Xaml文件功能
2013-01-05 09:23 by panmin, 2005 阅读, 收藏,
摘要:
功能点:1、读取XAML文件显示在界面上; 2、将XAML文件中的布局在DocumentViewer中显示,从而实现打印预览。一、读取指定的XAML文件XmlReader xr = new XmlTextReader(filePath);object ob = XamlReader.Load(xr);注:其中XAML文件是FixedPage为根节点的结构。二、将读取的文件转换成页 并绑定数据FixedPage fp = (FixedPage)ob; fp.DataContext = 数据源;三、将页加载到PageContent中PageContent pc = new PageContent( 阅读全文
Wpf和WinForm在窗体中处理用户自定义消息的不同方式
2013-01-08 15:19 by panmin, 1352 阅读, 收藏,
摘要:
WPF:在Visual的句柄创建后(如OnLoad、OnSourceInitialized代码里),使用下面方法:方法一:HwndSource source =PresentationSource.FromVisual(this) as HwndSource; //添加命名空间System.Windows.Interopif(source != null) source.AddHook(WndProc);方法二:HwndSource source =HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);if(source != nu 阅读全文
wpf与winForm界面控件遍历
2013-01-08 12:11 by panmin, 814 阅读, 收藏,
摘要:
WinForm: public void 遍历(Control c, ref List<Control> list ) { foreach (Control item in c.Controls) { list.Add(item); if (item.Controls != null && item.Controls.Count != 0) { 遍历(item, ref list); } } } public void... 阅读全文
WPF ListView实现DataGrid同样的效果
2013-01-06 10:21 by panmin, 765 阅读, 收藏,
摘要:
<ListView><ListView.View><GridView><!--表示一种视图模式,该模式以列的形式显示ListView控件的数据项源文档 <http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=ZH-CN&k=k(SYSTEM.WINDOWS.CONTROLS.GRIDVIEW);k(VS.XAMLEDITOR);k(SOLUTIONITEMSPROJECT);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2 阅读全文
浙公网安备 33010602011771号