Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >> 预览模式: 普通 | 列表

Difference between StaticResource and DynamicResource in WPF

This Article is Published by Live Writer。

A StaticResource will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored.

A DynamicResource assigns an Expression object to the property during loading but does not actually lookup the resource until runtime when the Expression object is asked for the value. This defers looking up the resource until it is needed at runtime. A good example would be a forward reference to a resource defined later on in the XAML. Another example is a resource that will not even exist until runtime. It will update the target if the source resource dictionary is changed.

from stackoverflow.com by Phil Wright

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 458 | 返回顶部

Quote of the Day:Get Started!

This Article is Published by Live Writer。

“It's the job that's never started that takes the longest to finish.” - J.R.R. Tolkien

Tags: DongPad

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 406 | 返回顶部

ZT-Silverlight Documentation Refresh

This Article is Published by Live Writer。

The documentation for a published product periodically receives corrections and bug fixes in a refresh update that publishes many of the changes at once. On occasion there may even be new content added that was produced since the last release.

Silverlight 3 recently had a documentation refresh to fix bugs, but what I noticed first was that an offline documentation collection was being kept in sync with the changes to the MSDN documentation. I like having an offline copy of the documentation because of the speed and responsiveness when browsing through the documentation locally.

Here's the documentation collection for Silverlight 3 compiled into a help file if you also like having access to documentation offline.

from:Nicholas Allen's Indigo Blog


Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 319 | 返回顶部

Net体系结构图

This Article is Published by Live Writer。

image

原文地址

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 438 | 返回顶部

Applications = Code + Markup读书笔记(2)

This Article is Published by Live Writer。

1.由RGB三原色组成的颜色空间也叫sRGB颜色空间,sRGB空间将显示点阵图像的做法正式化
The RGB color space implied by byte values of red, green, and blue primaries is sometimes

known as the sRGB color space, where s stands for standard. The sRGB space formalizes

common practices in displaying bitmapped images from scanners and digital cameras on

computer monitors. When used to display colors on the video display, the values of the sRGB

primaries are generally directly proportional to the voltages of the electrical signals

sent from the video display board to the monitor.

2.引入了scRGB的概念,也被称为sRGB64
关于scRGB的Wikipedia: http://en.wikipedia.org/wiki/ScRGB

3.sRGB三原色存储类型为byte,scRGB三原色存储类型为float,由于scRGB可以大于1或小于0,所以scRGB颜

色空间更大

4.Brush体系结构
Object
└─DispatcherObject (abstract)
   └─DependencyObject
      └─Freezable (abstract)
         └─Animatable (abstract)
            └─Brush (abstract)
               ├─GradientBrush (abstract)
               │ ├─LinearGradientBrush
               │ └─RadialGradientBrush
               │
               ├─SolidColorBrush
               │
               └─TileBrush (abstract)
                  ├─DrawingBrush
                  ├─ImageBrush
                  └─VisualBrush

5.关于Brush的动态事件机制,如上结构图,Brush继承自Freezable,而Freezable实现了changed事件,所以

只要Brush改变,都会通知事件的订阅者,该示例中就是通知Window来重绘窗体了,这一点需要和Winform进

行区分,Winform中除非人为处理,否则更改颜色不会触发窗体绘制
Obviously somebody is redrawing the client area every time the brush changes, but it's all

happening behind the scenes. This dynamic response is possible because Brush derives from

the Freezable class, which implements an event named Changed. This event is fired whenever

any changes are made to the Brush object, and this is how the background can be redrawn

whenever a change occurs in the brush.

This Changed event and similar mechanisms are used extensively behind the scenes in the

implementation of animation and other features in the Windows Presentation Foundation.

6.Brushes.PaleGoldenrod和new SolidColorBrush(Colors.PaleGoldenrod)虽然得到的是相同的brush,

但是在使用的时候要考虑到前者不允许被修改,因为前者是一个静态只读属性,还需要注意到Frozen的相关概念
The SolidColorBrush objects returned from the Brushes class are in a frozen state, which

means they can no longer be altered

7.LinearGradientBrush及RadialGradientBrush的一些属性和示例应用

活学活用,切勿读死书 @_@

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 335 | 返回顶部

CREATING A GLASS BUTTON: THE COMPLETE TUTORIAL

This Article is Published by Live Writer。

Well, it was a while back that I posted the first Creating a Glass button tutorial. Of course, that was based on the old look of Sparkle, and I have had some feedback recently that the project doesn't run anymore. Also, the completed tutorial never 'made it to press' leaving people with a rather lifeless button.

Well folks - GREAT NEWS - I have finished working on a all new glass button. And what better design to follow than some of the glass buttons in our shiny new OS.

Windows Vista task bar

The Windows Vista taskbar has some real nice buttons - they are see through and have an internal glow. So, I though I would base my all new complete glass button tutorial on these babies. I also hope there is enough content in the tutorial to help you explore other designs and other controls.

picture of the glass buttons app runing

So, attached to this post are the full instructions for creating the buttons above. I have also attached the finished project if you want to explore what I have done.

This has been a while coming, so please enjoy!

Attachment(s): CreatingTheGlassButton.zip

From:Martin Grayson

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 435 | 返回顶部

LINQ学习笔记及总结(1)

完整下载:/Files/DongPad/LINQApp.7z

//【一个比较简单的需求,找出年龄大于25小于30的Person】
List lpsTmp = new List{
new Person{ID=1000,Name="A",Age=24},
new Person{ID=1001,Name="B",Age=26},
new Person{ID=1002,Name="C",Age=28},
new Person{ID=1003,Name="D",Age=30},
new Person{ID=1004,Name="E",Age=32}
};
//-------------------------------------------------------
//【方式1】如果是在net1.1(1.1中还没有引入泛型概念)或2.0中,直接遍历
Console.WriteLine("方式1");
foreach (Person p in lpsTmp)
{
if (p.Age > 25 && p.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
    }
}
//-------------------------------------------------------
//-------------------------------------------------------
//【方式2】使用List的FindAll来实现,这里主要用到了2.0里的Predicate泛型委托
// Predicate可以省略
Console.WriteLine("\r\n方式2");
lpsTmp.FindAll(new Predicate(FindMatchPerson2));
//或
lpsTmp.FindAll(FindMatchPerson2);
//-------------------------------------------------------
//-------------------------------------------------------
//【方式3】方式2中我们需要额外的定义一个方法用来匹配集合中的对象
//我们可以使用更简洁的语法,那就是匿名方法, Predicate可以省略
Console.WriteLine("\r\n方式3");
lpsTmp.FindAll(new Predicate(delegate(Person p)
{
if (p.Age > 25 && p.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
return true;
    }
return false;
}));
//或
lpsTmp.FindAll(delegate(Person p) { return true; });
//-------------------------------------------------------
//-------------------------------------------------------
//【方式4】方式3中我们通过匿名方法避免了去定义一个额外的判断方法
//接下来我们来使用lambda表达式实现同样的效果
//Lambda表达式实际上为书写匿名方法提供了一种更加简单、更加函数化的语法
Console.WriteLine("\r\n方式4");
var lsps4 = lpsTmp.FindAll(new Predicate(p => p.Age > 25 && p.Age < 30));
//或
lsps4 = lpsTmp.FindAll(p => p.Age > 25 && p.Age < 30);
foreach (Person p in lsps4)
    Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
//-------------------------------------------------------
//-------------------------------------------------------
//【方式5】接下来我们使用Linq的一些静态方法,实际上List的一些扩展方法,Func可以省略
Console.WriteLine("\r\n方式5");
var lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(FindMatchPerson2)).ToList();
//或
lsps5 = System.Linq.Enumerable.Where(lpsTmp, FindMatchPerson2).ToList();
//上面的【方式5】与【方式2】比较类似,都是委托给FindMatchPerson2来执行
//下同【方式3】,使用了匿名方法,可以省略Func
lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(delegate(Person ppTmp)
{
if (ppTmp.Age > 25 && ppTmp.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", ppTmp.Name, ppTmp.ID, ppTmp.Age));
return true;
    }
return false;
})).ToList();
//下同【方式4】,使用lambda表达式,可以省略Func
lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(p => p.Age > 25 && p.Age < 30)).ToList();
//-------------------------------------------------------
//-------------------------------------------------------
//【方式6】接下来我们使用List的一些扩展方法,这主要是为了接下来使用Linq做个铺垫
//因为linq的本质就是使用扩展方法扩展了对集合类型的各种查询方法,Func可以省略
Console.WriteLine("\r\n方式6");
var lsps6 = lpsTmp.Where(new Func(FindMatchPerson2)).ToList();
//或
lsps6 = lpsTmp.Where(FindMatchPerson2).ToList();
//上面的【方式6】与【方式2】比较类似,都是委托给FindMatchPerson2来执行
//下同【方式3】,使用了匿名方法,可以省略Func
lsps6 = lpsTmp.Where(new Func(delegate(Person ppTmp)
{
if (ppTmp.Age > 25 && ppTmp.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", ppTmp.Name, ppTmp.ID, ppTmp.Age));
return true;
    }
return false;
})).ToList();
//下同【方式4】,使用lambda表达式,可以省略Func
lsps6 = lpsTmp.Where(new Func(p => p.Age > 25 && p.Age < 30)).ToList();
//-------------------------------------------------------
//-------------------------------------------------------
//【方式7】最后我们使用Linq语法来实现同样的效果
Console.WriteLine("\r\n方式7");
var lsps7 = from p in lpsTmp where p.Age > 25 && p.Age < 30 select p;
foreach (Person p in lsps7)
    Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
//-------------------------------------------------------
//-------------------------------------------------------
//通过这里列出的几种实现方式,我们会发现用来实现的代码越来越简洁,随之提升将不仅仅是编码效率哦.吼吼!!!
//这里除了Linq,成员方法,静态方法和扩展方法都可以分别使用命名委托、匿名委托或Lambda表达式作为参数!!!
//这里代码演变到简洁的过程如下:
//命名委托==>匿名委托==>Lambda表达式
//成员方法(list.FindAll)==>静态方法==>扩展方法==>Linq
//综上所述,Linq的本质无外乎委托,整一个活生生的"语法糖",他把许多东西都交给编译器来处理了
//由此可见,在学习的过程中举一反三还是比较重要的,知其然更要知其所以然,通过了解本质,对于我们来说将更容易掌握知识,应用知识!!!
//所涉及之处,难免会存在一些问题,诚恳希望大伙们能够提出并一起讨论!!!
//参考资料:《LINQ-the future of data access in c# 3.0》
//-------------------------------------------------------


Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 316 | 返回顶部

44个Silverlight 视频讲座

This Article is Published by Live Writer。

01. Silverlight - Hello World
02. Silverlight - Anatomy of an Application
03. Silverlight - The VS Environment
04. Silverlight - Content Controls
05. Silverlight - Built-In Controls
06. Silverlight - Width, Height, Margins, Padding, Alignment
07. Silverlight - Using a GridSplitter
08. Silverlight - Grid Layout
09. Silverlight - StackPanel Layout
10. Silverlight - Canvas Layout
11. Silverlight - Databinding UI to .NET Classes
12. Silverlight - Simple Styles
13. Silverlight - Custom Types in XAML
14. Silverlight - Binding with Conversion
15. Silverlight - List Based Data Binding
16. Silverlight - Simple User Control
17. Silverlight - Templating a Button
18. Silverlight - Resources from XAP/DLL/Site Of Origin
19. Silverlight - Animations & Storyboards
20. Silverlight - Uploads with WebClient
21. Silverlight - Downloads with WebClient
22. Silverlight - Calling HTTPS Web Services
23. Silverlight - Calling Web Services
24. Silverlight - Making Cross Domain Requests
25. Silverlight - Using HttpWebRequest
26. Silverlight - File Dialogs and User Files
27. Silverlight - Using Sockets
28. Silverlight - Using Isolated Storage
29. Silverlight - .NET Code Modifying HTML
30. Silverlight - Using Isolated Storage Quotas
31. Silverlight - Calling JavaScript from .NET
32. Silverlight - Evaluating JavaScript from .NET Code
33. Silverlight - Handling HTML Events in .NET Code
34. Silverlight - Handling .NET Events in JavaScript
35. Silverlight - Calling .NET from JavaScript
36. Silverlight - Displaying a Custom Splash Screen
37. Silverlight - Passing Parameters from your Web Page
38. Silverlight - Loading Media at Runtime
39. Silverlight - Dynamically Loading Assemblies/Code
40. Silverlight - Reading/Writing XML
41. Silverlight - Multiple Threads with BackgroundWorker
42. Silverlight - Insert/Update/Delete with the DataGrid
43. Silverlight - Getting Started with the DataGrid
44. Silverlight - Embedding Custom Fonts

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 380 | 返回顶部

Applications = Code + Markup读书笔记(1)

This Article is Published by Live Writer。

1. 关于Application和Window的层次结构

Object
└─DispatcherObject (abstract)
    ├─Application
    └─DependencyObject
        └─Visual (abstract)
           └─UIElement
               └─FrameworkElement
                   └─Control
                       └─ContentControl
                           └─Window

2.如果没有显示的设置Window的宽或高,他们的值将始终是NaN

The Width and Height properties are initially undefined, and if your program never sets them, they remain undefined, which means they have values of NaN, the abbreviation immortalized by the IEEE (Institute of Electrical and Electronics Engineers, Inc.) floating-point standard for "not a number."

3.与设备无关单位(1/96inches),这一点需要与DPI进行区分

The units in which you specify all dimensions and locations in Windows Presentation Foundation are sometimes called device-independent pixels or logical pixels but it's probably best not to refer to pixels at all.

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 372 | 返回顶部

横穿马路被电视台抓住采访时要沉着应答

This Article is Published by Live Writer。

一天,在回家的路上,被一群拿着摄像机的家伙拦住了,   其中一个什么也没有拿的靓女说他们是XX报社的,要采访我。   采访开始后,那靓女问我:“刚才你是不是从马路中间的护栏上跳过来的?“我说是,没错。她问我知道那么做不对吗?知道不对为什么还要违反交通规则?  

我说为了节省时间,时间就是金钱就是生命,浪费我的时间就等于图我的财害我的命,   这是鲁迅先生说过的话。那靓女听我说完愣了半天,   然后才想起来问:难道就不知道那么做是很危险的吗?我说习惯就好了,这世界上哪有绝对安全的地方?地球是转动的,生命是运动的,一不留神谁都能玩完,睡觉都能活活把人睡死吃饭都能把人活活噎死,想通这些,跳个护栏还怕什么危险?她对我的回答很感意外,只是傻傻地站着,不知该再问我什么才好。于是我主动地伸手和她握握,很友善的说:“是实习生吧,没什么事我先走了。在又一次回家的路上,我又被一群拿着摄像机的家伙拦住了(烦),其中一个什么也没有拿的比原来那个靓女更靓的靓女说她们是XX报社的,要采访我。采访开始后,那靓 女问我:“刚才是不是从马路中间的护栏上跳过来的? “我说是,没错。她问我知道那么做不对吗?知道不对为什么还要违反交通规则?我说为了节省时间,时间就是金钱就是生命,浪费我的时间就等于图我的财害我的命,这是鲁迅先生说过的话。那靓女听我说完咯咯笑了半天,然后才想起来问:要是被车撞了你更得损失时间损失金钱甚至生命,难道你觉得那么做是很值得的吗?我说想开就好了,这世界上哪有绝对值得的事情?地球是转动的,生命是运动的,一不留神谁都能玩完, 美国游骑兵部队听过吧,NB吧,叫索马里民兵打的满街跑;人拜神社知道吧,无耻吧,就有人给他泼墨水;以色列杀巴勒斯坦人不当回事吧,就有人宁可挨子弹也要扔他一石头。没有什么事是稳赚不赔的,想通这些,跳个护栏还怕什么危险?有的人连万年唾骂都不怕了冒死要把台湾岛分出去,他们都不怕我为什么怕呢?她对我的回答很感意外,但是她的水平似乎要高一点  

她坚持问:“那些事情都是国家大事 你不认为用这些事情来证明你翻护栏正确是   很没有道理的么? ”  

我说,皮之不存,毛将焉附, 一般来说我们大礼不拘小节、大义不存小仁,一个人如果不翻护栏,他无非是个好市民,但一个人如果国家大事的对错都分不清楚,就非常可怕了,我宁可做一个为时间为事业为祖国而不惜生命的人,也不愿意做一个面对一道护栏苟且偷生的人,连小溪都不能渡过的树叶,如何横越海洋,连护栏都不跨过,能指望这样的人在战场上冒着敌人的炮火舍生忘死,冲锋陷阵么?  

她只是傻傻地站着,不知该再问我什么才好。于是我主动地伸手和她握握,   很友善的说:“你是和那个实习生一起参加工作的吧,没什么事我先走了。不用担心,日子长了就好了。”

from:笑口常开

Tags: DongPad

分类:Relax Bar | 固定链接 |评论: 0| 引用: 0 | 查看次数: 369 | 返回顶部
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >>