Here’s a quickie. I had an issue where I have a ListBox that will (should) never scroll but I need its item selection capability. It is inside of another ScrollViewer (along with some other controls) and that outer ScrollViewer should be what scrolls. Unfortunately ListBox was eating the MouseWheel events, preventing the outer ScrollViewer from [...]
Posts tagged WPF
Another multi-purpose value converter for WPF
Colin Eberhardt has posted a neat multi-purpose value converter that tries various conventional conversion methods to convert from one type to another. This overcomes a frustrating limitation in WPF/Silverlight data binding where the XAML parser is seemingly more intelligent at converting literal values to target types than values sourced from binding expressions. Unfortunately, the TypeConverter [...]
SwitchConverter – A "switch statement" for XAML
Download the example project which includes the source for SwitchConverter and SwitchedContent. I figured I would write some more about value converters since I think there’s a lot of cool things you can do with them, especially when you put a little extra effort into generalizing them. One thing I find I need to do [...]
A multi-purpose NegateConverter for WPF/Silverlight
I came across a question on StackOverflow that is a very frequently asked question regarding data binding in XAML. Given a boolean, how do you bind the opposite value to the target? The answer of course is to use a value converter (a class implementing IValueConverter) and invert the boolean in code. I do this [...]
WPF : Using Markup Extensions to generate content with icons
It’s way too hard to get an image next to the text content of a Button, TextBlock, ListBoxItem, TreeViewItem, etc. Coming from a Windows Forms background where many controls had an Image property for displaying a small glyph next to text content, I am constantly frustrated by the verbose XAML required to achieve the same [...]
Excellent WPF performance tips on the Visual Studio Blog
These aren’t your typical, obvious tips. Head over to the Visual Studio Blog to learn some WPF performance tips that the team picked up during the development of Visual Studio 2010. Some of the performance issues required changes to WPF that we all will benefit from in .NET 4. Others are clever ways to work [...]
FullScreenBehavior makes full-screen apps in WPF easy
Download FullScreenDemo Project So now I’m working on an application that will be used at a trade show in a booth. Customers will come up to the application and type in the area code and exchange of their phone number and the application will tell them whether or not they can move their phone number [...]
Why Windows Presentation Foundation (WPF) is the best thing to happen to Tablet PC’s
I’ve finally gotten around to actually playing with Windows Presentation Foundation in Visual Studio and I’m really blown away by the capabilities. As a GUI guy, I can totally appreciate all the work they’ve put into this framework and I am relieved to see most of the problems with GDI+/Windows Forms being addressed. WPF will [...]
Posts