View source on GitHub. In part 1 of this article I looked at the differences between WPF tooltips and ‘native’ (Win32) tooltips. In this part I present a sample WPF application that displays native tooltips. I’d planned to walk through some of the code here, but that turned out to be a bit tedious, so… Continue reading Native Tooltips in WPF (Part 2)
Tag: wpf
Native Tooltips in WPF (Part 1)
View source on GitHub. <preamble> One of my hobbies is getting WPF controls to look more like their native counterparts. I’ve been shoehorning the UxTheme APIs (and older equivalents when theming is unavailable) into something that can be used by WPF over the past year or more, and I’ll write about this process at some… Continue reading Native Tooltips in WPF (Part 1)
WPF ToolTip Drop Shadows in Windows 8
The standard ToolTip control template for the Windows 8 theme in WPF (‘Aero2’) has no drop shadow, whether or not the HasDropShadow property is set. The background colour and margins are also slightly off compared to the native style. The following template produces a result that’s closer to the real thing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<Style TargetType="{x:Type ToolTip}"> <Setter Property="Foreground" Value="#FF575757" /> <Setter Property="Background" Value="#FFFFFFFF" /> <Setter Property="Padding" Value="5,1,6,2" /> <Setter Property="HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}" xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"> <themes:SystemDropShadowChrome Name="Shdw" themes:SystemDropShadowChrome.Color="Transparent" themes:SystemDropShadowChrome.CornerRadius="0" SnapsToDevicePixels="True"> <Border Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True"> <ContentPresenter TextOptions.TextFormattingMode="Display" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> </Border> </themes:SystemDropShadowChrome> <ControlTemplate.Triggers> <Trigger Property="HasDropShadow" Value="True"> <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> <Setter TargetName="Shdw" Property="themes:SystemDropShadowChrome.Color" Value="#71000000" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> |
You’ll need to… Continue reading WPF ToolTip Drop Shadows in Windows 8
Pixel-perfect Multi-DPI Images in WPF (Part 3)
View source on GitHub. In Part 1 of this series, I discussed the problem of displaying different bitmap images at different DPIs in WPF. In Part 2, I proposed a solution using multi-frame TIFFs and two simple markup extensions. In this final post I will present a basic program that takes multiple images (PNG recommended),… Continue reading Pixel-perfect Multi-DPI Images in WPF (Part 3)
Pixel-perfect Multi-DPI Images in WPF (Part 2)
View source on GitHub. See also: Part 1 and Part 3. In Part 1 of this series, I explored the issue of displaying pixel-perfect bitmap images in the Windows Presentation Foundation. In this article, I’ll describe a method of displaying different images depending on the system DPI setting using a custom Markup Extension and multi-image… Continue reading Pixel-perfect Multi-DPI Images in WPF (Part 2)
Pixel-perfect Multi-DPI Images in WPF (Part 1)
View source on GitHub. See also: Part 2 and Part 3. I’ve written previously about DPI-awareness in the Windows Presentation Foundation and how to specify measurements in pixels rather than Device Independent Units (DIUs). Something else to consider is image scaling – unlike the Windows Ribbon control or WinRT, WPF has no in-built mechanism for… Continue reading Pixel-perfect Multi-DPI Images in WPF (Part 1)
FastPictureViewer Codec Pack, Windows 8 and WPF don’t play nicely together
Update (2012-09-06): After some trial and error, it seems the Canon Hack Development Kit (CHDK) component is causing the issue. If you’re experiencing the same problem, try removing this component. Update (2012-09-05): The FastPictureViewer support team was unable to reproduce the issue, but suggested it might have something to do with the JPEG Auto-Rotate feature.… Continue reading FastPictureViewer Codec Pack, Windows 8 and WPF don’t play nicely together
Keiki Usage Meter 3.1.0 Released
I’ve released an update for Keiki Usage Meter. There has been a lot of behind-the-scenes work, but the user experience hasn’t changed drastically. Visit the website to find out what’s new. I’m using this program as something of a testbed for some engineering work that I’ll talk about in future posts, including supporting pixel-perfect bitmap… Continue reading Keiki Usage Meter 3.1.0 Released
WPF: Using System Colours in Animations
WPF provides access to the Windows system colours through the System.Windows.SystemColors class. As the MSDN documentation indicates, it’s possible to bind to these colours dynamically using the *Key resources, so when the system colours change, so will the appearance of your application. This code will set the colour of a TextBlock to the ‘GrayText’ system… Continue reading WPF: Using System Colours in Animations
When should a program’s UI animations be disabled?
Modern frameworks like the Windows Presentation Foundation, its relative Silverlight and the upcoming Windows Runtime make it easy to add animations to a program’s graphical user interface. When implemented well, animations subtly improve the user experience and can demonstrate a high level of polish in your application. The Zune client software and Windows Live Messenger… Continue reading When should a program’s UI animations be disabled?