background preloader

WPF

Facebook Twitter

WPF Controls

MVVM. Lester's WPF blog. Vista look on Non-Aero themes. I've tested this, but the results is not here, I work with .NET 3 RTM, VS 2005 Team Suite and extension for WPF/WCF on Windows XP Pro SP2, I've test this piece of code : "<Window x:Class="avirer.Window1" xmlns=" xmlns:x=" Title="WPFTestThemes" Height="300" Width="300">

Vista look on Non-Aero themes

Data Binding in WPF. Data Points Data Binding in WPF John Papa Code download available at:DataPoints2007_12.exe(161 KB) By now, many of you know that Windows® Presentation Foundation (WPF) makes it easy to design robust user interfaces.

Data Binding in WPF

But what you probably didn't know is that it also provides powerful data-binding capabilities. WPF and Property Dependencies. Download demo project - 13.93 KB Introduction One of the most difficult aspects in creating applications from user requirements is the process of capturing the information that pertains to control behaviors.

WPF and Property Dependencies

Situations where controls have many dependencies on both data and the state of other controls often lead to spaghetti code. In this article, I am going to look at some of the ways of capturing these requirements and turning them into manageable chunks of XAML and C#. A Look at Data Binding For a control to have its data saved somewhere, we can use a variety of methods. ... and then store the value manually: private void textBox1_TextChanged(object sender, TextChangedEventArgs e) { myString = textBox1.Text; } This method is fairly simple, but it has far too many disadvantages. Optimizing WPF Application Performance. Series on GPU-based Effects for WPF. Render Silverlight in WPF.

A hobby project I have been working on, to clear my mind of the daily grind, is a Control that lets a developer host a Silverlight application to WPF. A good kept secret is there is complete COM API for hosting Silverlight outside the browser. There is even sample C++ code here . The problem I found with all of these was everything assumed you are rendering to Win32/Windowed. This is not the kind of thing we want in a WPF application. Airspace restrictions are for weenies. I had remembered that Silverlight DOES infact support windowless. I did start out using the WriteableBitmap, but eventually moved over to use InteropBitmap and performance got even better!

Anyways, there’s still a lot of work to be done, but I’m excited enough about it to show it off now. WPF SilverlightViewport. WPF in Visual Studio 2010 - Part 1. This is the first part in a seven part series.

WPF in Visual Studio 2010 - Part 1

Links to the other parts are included at the bottom of this post. Now that the Release Candidate for Visual Studio 2010 is publicly available, we’ve started receiving questions from inquisitive users about how Visual Studio 2010 itself was built. In particular, one questioner wanted to know if we were going to keep all the WPF “magic” to ourselves. Registering to a DependencyProperty's Change Event. Receive notifications for dependency prope. Receiving notifications for dependency property changes on an existing object is a very common scenario.

Receive notifications for dependency prope

The way to do it properly is not very obvious. So much so that while reviewing some code, I found the following snippet. // Believe it or not, this seems to be the only way to get change// notifications for DPs unless you derive from the relevant// class and override OnPropertyChanged. PropertyDescriptor prop = TypeDescriptor.GetProperties(obj)["Prop"]; prop.AddValueChanged(obj, delegate { viewModel.RaisePropertyChanged("Prop"); }); There's a few issues with this code. Creating 3D Models for WPF. I’ve had an opportunity recently to play around with WPF’s 3D capabilities to try and recreate part of the Tesco product viewer demo at PDC08.

Creating 3D Models for WPF

Of course one of the first hurdles is actually having some sort of 3D model to play with (once you get bored with a cube). There are lots of sites where you can download 3D models in various formats (many of them chargeable) but I wanted to understand a little about the tools and techniques so I decided to build a few simple 3D models myself. Use XamlReader.Load for WPF XAML. How to get access to WPF’s internal. —Executing Commands with Input Gestures. Using the Help command in such a simple dialog may seem like overkill when a simple event handler for Click would do, but the command has provided an extra benefit (other than localized text): automatic binding to a keyboard shortcut.

—Executing Commands with Input Gestures

Applications typically invoke their version of help when the user presses the F1 key. Sure enough, if you press F1 while displaying the dialog defined in Listing 3.10, the Help command is automatically launched, as if you clicked the Help Button! That's because commands such as Help define a default input gesture that executes the command. You can bind your own input gestures to a command by adding KeyBinding and/or MouseBinding objects to the relevant element's InputBindings collection. For example, to assign F2 as a keyboard shortcut that executes Help, you could add the following statement to AboutDialog's constructor: this.InputBindings.Add( new KeyBinding(ApplicationCommands.Help, new KeyGesture(Key.F2))); Synchronizing the width of elements in an ItemsControl « Josh Sm. When I use an ItemsControl (or subclass of ItemsControl, such as ListBox) to display a list of items, I often want the width of an element in each item to match the width of the equivalent elements displayed for all other items.

Synchronizing the width of elements in an ItemsControl « Josh Sm

That is easy to achieve by setting the Width property of an element in the DataTemplate used by the ItemTemplate property, but using hard-coded width and height values is generally considered to be a bad practice. It’s better to not specify a width, and let the element figure out how big it should be based on its content. WPF Dialogs and DialogResult. In WPF Dialogs are quite different from Windows Forms.

WPF Dialogs and DialogResult

The behavior is still the same i.e when you have a Dialog opened (by calling the ShowDialog() method) the user must close the dialog in order to use the Window that opened the Dialog Window. The difference is the way you handle the Dialog Result and also how to set Dialog Results. Let’s say that you created a Window in Windows Forms and you have a Button. You can set the DialogResult property of the button so that when the user click on that button the Dialog ends with the Dialog Result that you have set.

How does the WPF Button.IsCancel property work? JCQ.