WinDays 16 session: UWP XAML Behaviors

This was my fifth year in a row of speaking at the most important Microsoft conference in Croatia, WinDays 16, where I gave two session. The first one was about XAML Behaviors, and the second one was about Entity Framework Core 1.0 in UWP apps. This article has the presentation I gave about XAML Behaviors plus the link to the demos for that session. PowerPoint presentation: Link to GitHub demos: Code includes EventTriggerBehavior demo DataTriggerBehavior demo Custom behaviors/actions demo…

Read More

UWP DropImageBehavior - drag and drop photos using a behavior

I wrote a simple but useful UWP behavior that's based on the great XAML Behaviors SDK and allows easy, reusable way to add drag and drop support for photos. The idea is to just be able to define the behavior on the drop surface and set the target image object. Dragging and dropping images usually takes some code behind unless behaviors are used so it can be plugged in anywhere in XAML declaratively. Here's the code for the behavior: [ContentProperty(Name = "Actions")] public class DropImageBehavior : DependencyObject, IBehavior { private BitmapImage bitmapImage = null; public static readonly DependencyProperty ActionsProperty = DependencyProperty.Register(nameof(Actions)…

Read More

Focus a TextBox from ViewModel using a simple behavior

Let's assume a simple scenario - you have a Windows Phone page connected to a ViewModel (VM) with everything bound nicely. A TextBox text property is connected to a string in VM, and when you change it, you wish to put focus on the TextBox. How to accomplish this considering that all your logic is actually in the VM separated from the View? Simply, using a focus behavior. Let's start with a simple UI. We have a MainPage with a TextBox and a Button in the main Grid, and the DataContext bound to a MainViewModel object. <phone:PhoneApplicationPage x:…

Read More

MVP Reconnect - say hi on Twitter

Microsoft MCSD

profile for igrali at Stack Overflow, Q&A for professional and enthusiast programmers

Latest Posts