
C#
idebian
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Data Virtualization in WPF and beyond
IntroductionHow do you show a 100,000-item list in WPF? Anyone who tried to deal with such a volume of information in a WPF client knows that it takes some careful development in order to make it w转载 2013-03-02 23:58:37 · 501 阅读 · 0 评论 -
UIElement.OnRenderSizeChanged
When overridden in a derived class, participates in rendering operations that are directed by the layout system.This method is invoked after layout update, and before rendering, if the element's Ren原创 2013-03-17 22:37:31 · 1332 阅读 · 0 评论 -
Dispatcher.PushFrame()的作用
相信您在使用WPF的过程中也遇到过这种问题:如果UI线程执行了非常耗时的计算并尝试在执行过程中更改UI组成中的内容,WPF界面并不会立即发生更改。对于需要给出即时信息的用户需求而言,WPF的这种延迟绘制功能反而给软件开发人员带来了极大的不便。当然,从根本上解决该问题的方法就是将该耗时计算单独置于工作线程中。只是这种解决方案常常由于某些限制无法施行:对于某些遗留代码来说,将耗时计算单独抽离是一件较为转载 2013-03-18 13:04:53 · 2542 阅读 · 0 评论 -
WPF Snippet - Reliably Getting The Mouse Position
The following quote is taken verbatim from the MSDN page onMouse.GetPosition:During drag-and-drop operations, the position of the mouse cannot be reliably determined through GetPosition.This is转载 2013-03-17 23:18:28 · 745 阅读 · 0 评论 -
Sharing Message Loops Between Win32 and WPF
This topic describes how to implement a message loop for interoperation with Windows Presentation Foundation (WPF), either by using existing message loop exposure inDispatcher or by creating a separ转载 2013-03-18 22:42:40 · 1258 阅读 · 0 评论 -
Extending the WPF XML namespaces
When referencing controls from another assembly in XAML, one can either use xmlns:foo="clr-namespace:MyNamespace;assembly=MyAssembly" syntax, or a URI mapped with theXmlnsDefinition attribute. MSD转载 2013-03-20 23:38:43 · 548 阅读 · 0 评论 -
Namespace in xaml
传统的我们在xaml中引用自己的类型都需要写xmlns,比如说,在WpfApplication1中定义Test01namespace WpfApplication1 { public class Test01 : UIElement { }}在ClassLibrary1中定义Test02namespace ClassLibrary1 { public class Tes转载 2013-03-20 23:43:04 · 1019 阅读 · 0 评论 -
正确理解WPF中的TemplatedParent
(注:Logical Tree中文称为逻辑树,Visual Tree中文称为可视化树或者视觉树,由于名称不是很统一,文中统一用英文名称代表两个概念,况且VisualTreeHelper和LogicalTreeHelper也是WPF中提供的类名称)众所周知WPF中的Logical Tree是逻辑上定义的元素层次树,而实际上显示在屏幕上的元素层次树是Visual Tree,Visual Tre转载 2013-04-05 15:07:52 · 9592 阅读 · 0 评论 -
wpf richtextbox详解
http://msdn.microsoft.com/en-us/library/aa970909.aspxhttp://msdn.microsoft.com/en-us/library/aa970779.aspxhttp://msdn.microsoft.com/en-us/library/ms747133.aspx转载 2013-04-20 22:44:35 · 838 阅读 · 0 评论 -
WPF RICHTEXTBOX 和数据库读写图文的方法
做一个项目,需要图文一起存入数据库,在网上浏览了很久。终于实现了在RICHTEXTBOX里面和数据库读写图文的方法。存入数据库。 public string toxaml() { // Stream s = new MemoryStream(); // 其他的什么Stream类型都没问题 //// XamlWrite转载 2013-04-20 22:43:22 · 1298 阅读 · 0 评论 -
依赖属性的相关概念
首先,我们分析一下依赖属性产生的一个原因:由于一个类型的依赖属性大多数情况下都保持默认值,例如几百个button的fontsize一般都是一样的,甚至整个一个软件的fontsize都是一种。那么每个对象保存一个fontsize就显得没有那个必要了,我们必须通过一个方式来保存这个属性,来让所有一个类的对象共享这个属性。我们的想法是把他做成一个静态的值。但是如果直接定义一个:public st转载 2013-03-30 18:25:45 · 736 阅读 · 0 评论 -
在WPF中自定义控件 CustomControl
为快速地为你的应用定制一个零部件,你需要的是UserControl,这可以参考在WPF中自定义控件 UserControl, 为了让你打造的控件更标准化,更灵活以及更具有普遍意义,你需要用到的CustomControl,这正是本文要介绍的. 1、新建CustomControl 在选择控件基类后,第一件事情便是在你的项目中新建"CustomControl",我们会发现在项目中自动转载 2013-03-17 17:03:36 · 2606 阅读 · 0 评论 -
CollectionView.DeferRefresh() : My new best friend
Well, maybe not best friend but its a nice function. When working with bound collections in WPF you often end up dealing with aCollectionView. This is the MSDN documentation description of a Colle转载 2013-02-25 10:15:13 · 818 阅读 · 0 评论 -
What is SynchronizationContext, and what does it mean to capture and use it?
We in software development love abstractions. We’re rarely happy hardcoding to a particular implementation; rather, when writing higher-level systems, we abstract away the details of a particular imp转载 2013-02-21 23:43:02 · 437 阅读 · 0 评论 -
WPF:使用CommandManager.RegisterClassCommandBinding和RegisterClassInputBinding方法
这两个方法可以在自定义控件中建立内置WPF命令,比如WPF中TextBox内置复制,剪切,粘贴命令。其中RegisterClassInputBinding将一个命令和输入笔势(Input Gesture)联系在一起。这样响应输入笔势发生后,命令逻辑会运行。而RegisterClassCommandBinding则将命令和具体命令执行逻辑和命令判断逻辑联系起来。这样一个命令就有具体逻辑执行代码了。转载 2013-02-25 22:54:23 · 3711 阅读 · 0 评论 -
How to Navigate, Group, Sort and Filter Data in WPF
What is a CollectionView?WPF has a powerful data binding infrastructure. It allows you to bind almost any kind of collection directly to a view. But when it comes to sorting, filtering and grouping转载 2013-02-25 09:35:54 · 621 阅读 · 0 评论 -
父类的combobox与子类的combobox的关联实现方式
ComboBox1 ItemsSource-----binding twoway------〉集合1 SelectedItem -----binding twoway------>ItemObj1(这个东西要属于集合1)ComboBox2 ItemsSource------binding twoway-----〉集合转载 2013-02-22 23:48:52 · 447 阅读 · 0 评论 -
Build More Responsive Apps With The Dispatcher
It would be a shame if you put months of your life into creating an intuitive, natural, and even beautiful interface only to have your users tapping their fingers on their collective desks waiting for转载 2013-02-21 23:56:04 · 421 阅读 · 0 评论 -
使用Behavior动态对Cavas.Children赋值
Cavas的Children属性本身是不能用于绑定的,一种变通的方法是使用Behavior:using System.Windows;using System.Windows.Controls;using System.Windows.Interactivity;using System.Linq; namespace WpfApp1{ public pa转载 2013-03-12 14:20:04 · 714 阅读 · 0 评论 -
CREATING VIEWMODEL TO VIEW MAPPINGS
One of my favorite approaches to creating View/ViewModel pairs in WPF it to use data templates. Say you have a ViewModel called MyViewModel and it should be displayed in the UI as the View MyView.转载 2013-02-24 16:19:43 · 373 阅读 · 0 评论 -
ManualResetEvent使用演示
ManualResetEvent 允许线程通过发信号互相通信。通常,此通信涉及一个线程在其他线程进行之前必须完成的任务。当一个线程开始一个活动(此活动必须完成后,其他线程才能开始)时,它调用 Reset 以将 ManualResetEvent 置于非终止状态。此线程可被视为控制 ManualResetEvent。调用 ManualResetEvent 上的 WaitOne 的线程将阻止,并等待转载 2013-03-28 23:41:13 · 502 阅读 · 0 评论 -
c#中如何用xml来保存并提取图片
private void button1_Click(object sender, EventArgs e) { try{ int readByte = 0; // int bytesToRead = 100; string fileN转载 2013-04-20 22:24:38 · 3327 阅读 · 0 评论