DCSIMG
.NET - Essential WPF

Browse by Tags

All Tags » .NET (RSS)

NotifyingObject for WPF & Silverlight by Tomer Shamam

There are many ways notifying on property changed, and I think the most popular one is using the lambda expression solution: public class Ball : Model { private double _velocity; public double Velocity { get { return _velocity; } set { if (_velocity != value ) { _velocity = value ; NotifyPropertyChanged(() => Velocity); } } } } I’ve to say that using the lambda solution is cool and type safety. But, why should I bother creating a field member for each property, set it only if not equals to the...

Best Twitter Application for very fast Tweeting! by Tomer Shamam

Last weekend I’ve tried to find a very simple twitter application for sending messages very quickly over the twitter network,  so I’ve googled something like: “Best Twitter Application for very fast Tweeting” And not surprisingly I’ve got tons of twitter applications, but neither was simple to use nor suited to my needs. So I’ve decided to create another twitter application, were “very fast tweeting” is its main goal. So far I’ve created a new open source project in CodePlex , not yet published...

WPF ComboBox and C# Enum - The Love Story by Tomer Shamam

Q: How can I bind a property of type Enum (of any kind) to a ComboBox or ListBox controls? I bet that you Googled this question more than once. Did you find the correct answer? Well, I saw a lot of them, with code or XAML only, sorted, filtered, grouped, etc. With all the respect, I didn't get a generic answer with a two-way data-flow to a single enum-type property . See these links as an example: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2430540&SiteID=1 http://joshsmithonwpf...

WPF is DPI Dependent by Tomer Shamam

<Button Content="Click me!" Width="100" Height="100" /> Do you really know how many pixels in the button's width and height? Clicking F1 on Width and Height properties in Visual Studio, it is written that the "value is interpreted as a device-independent unit (1/96th inch) measurement". Now, the default value of DPI (dots per inch) in a default Windows installation with a simple Monitor is 96. Now let's calculate how many pixels you have: px ...
תגים:,

WPF Official Image Interop by Tomer Shamam

As I wrote my few last posts about how to access the BitmapSource WIC image pixels, I have found a post in the MSDN forum, which exposes a static class called Imaging . This amazing class which somehow was very hard to find, can do a great work with image-interop. Looking inside the MSDN for the Imaging class, I found the following methods: CreateBitmapSourceFromHBitmap CreateBitmapSourceFromHIcon CreateBitmapSourceFromMemorySection The CreateBitmapSourceFromMemorySection is the best match for creating...
תגים:, , ,

WPF Image Processing Under the Hood by Tomer Shamam

In the last two posts I have showed how to create a BitmapSource image and access its underlying WIC image, for manipulating its pixels. In this post I will explain how does the WICBitmap* works. Download the code from here . Looking inside the BitmapSource class using Reflector , it figures out that it encapsulates a WIC image (_ wicSource ). The WICBitmap class uses reflection to retrieve this private field: public WICBitmap( BitmapSource source) { Type bitmapSource = typeof ( BitmapSource ); FieldInfo...

WPF Raw Video by Tomer Shamam

In my last post I showed how to access the WPF's BitmapSource underlying WIC image, and I promised to explain my code, and also to post an Image stream (Video) code based on my solution. In this post I will quickly talk about the unique CompositionTarget class, and I will show how to render a Raw Video using its Rendered event. Download the code from here ( FYI - I refractor the code from the last post and fixed several bugs ). I will start by reminding one of the disadvantages of my WICBitmap...

WPF Image Processing by Tomer Shamam

With the release of Windows Vista and WPF, Microsoft has also released the WIC: "an extensible framework for working with images and image metadata. WIC makes it possible for independent software vendors (ISVs) and independent hardware vendors (IHVs) to develop their own image codecs and get the same platform support as standard image formats (for example, TIFF, JPEG, PNG, GIF, BMP, and WMPhoto)" (MSDN). Unsurprisingly, WPF uses WIC in its core (for example, BitmapSource ). Unfortunately...

WPF Model Data Binding - Part II by Tomer Shamam

In my previous post I showed how to design a data model which provides the following characteristics: Property notification changes In-memory state persistency Commit and Rollback mechanism Dirty flag In this post I will show how to handle multi-threading scenarios with WPF data binding. You can download the complete code from here . Before I will start, I want to give a little background of the WPF threading model, and to explain why you shouldn't change any data-bind object from a different thread...
תגים:, , ,

WPF Model Data Binding - Part I by Tomer Shamam

The Data Binding concept, first introduced with Windows Forms, provides a way for decoupling the View from the Data and for eliminating the boilerplate, mass code of marshaling the data to and from the view. WPF extends this mechanism by adding some great features, especially when dealing with Data Templates, which provides an easy way for reflecting the data with view. In WPF, Data Binding is everywhere! Data binding is a great mechanism, but there are some situations that data-binding not exactly...
תגים:, , ,

WinHEC 2007 by Tomer Shamam

Thanks to Alon Flies, I put my hand on the WinHEC 2007 video lectures. You can find Bill Gates Keynote very interesting. Click here , sit and enjoy.

WPF is O.O, Control Templates are not! by Tomer Shamam

The best feature in WPF, which I very appreciate, is that WPF is a real O.O framework. Its services are exposed as a pile of polymorphic types, having common base classes and interface implementation. As every aspect in the real life (especially in software), not everything is perfect and so is WPF. One of the things that I'm a little disappointed with is Control Templates. The big Why Control Template is a strong mechanism in WPF. With Control Templates, a control’s logic is totally separated from...
תגים:, , , ,

WPF - Good Design Principles by Tomer Shamam

Last few days, I saw a WPF Video Post that demonstrates how to start a blast graphic effect, based on image series. See this link . Yap, this is a very cool blast, but IMHO this is not the right way to go with WPF. The tips bellow will help you to redesign the application correctly, using WPF fundamentals. Tip 1: Design your model/data to support Data Binding (provide property for almost everything). Do not forget that data-binding in WPF is everywhere! Tip 2 : Do not hesitate to use Dependency Properties...
תגים:, , ,
Powered by Community Server (Commercial Edition), by Telligent Systems