Touch and Hold Gesture – Awaitable

Touch and Hold gesture can not be identified using any built-in API. Surface SDKs may provide one. But I will show a simple awaitable way to detect this gesture. Using a timer, we can wait for a particular seconds and return the method once the timer elapsed. If user took his hand before timer elapsed, then... Continue Reading →

WPF DatePicker – BlackOutDates Data Binding

A problem with DatePicker is that BlackoutDates collection cannot be initalized without a Calendar instance. So in MVVM environment, it is bit hard to bind BlackoutDates dynamically. But attached properties are a handy way to handle these type of situations. An attached property of type List<DateTime> can be used to achieve this. The dates will... Continue Reading →

WPF FlipView

FlipView control behaves like an ItemsControl and shows items one by one on swipe gesture. Also navigation buttons will be available to navigate using mouse. Many users nowadays expecting Windows store touch apps to be developed using WPF. That doesn't require to be published on store for distribution. Same time all the features and behaviors... Continue Reading →

WPF Style Inheritance

A style in WPF can be inherited. Usually, in real world scenarios most of the theme related styles will be merged in App.xaml. In such cases, if style needs to be defined again in scope of a view. That particular style will override the style defined in App. For example, the following style for ListBoxItem... Continue Reading →

Order does matter for WPF Triggers

When applying style for a ListBoxItem, today I come across a weird problem. I have trigger for both Mouse over and Selected. On selected, the item should goLightBlue and Gray on mouse hover. But when user clicks an item, it gets selected. But still the color remains Gray. But when user leaves the mouse, it... Continue Reading →

AccentBrush for WPF Metro Theme

Mah Apps provide a very easy way to style any WPF applications with Metro theme. They provided 22 different accent colours and two themes dark and light. Just by merging the resources in App.Resources, your app will look pretty much like Metro app. Theme and accent brush can be dynamically switched by using following code.... Continue Reading →

Up ↑