During BASTA Austria I have been asked a WPF question. How can I implement a confirmation question that is asked whenever a user checks a CheckBox? Imagine the following dialog:
Our goal is to display an "Are you sure?" message if the user checks "Delete everything!" or hits the "Delete Everything (in Code)" button. There should not be a message box if the user unchecks the "Delete everything!" check box.
XAML Source (Without Confirmation Message)
Here you see the XAML source with which we start:
The code behind file just connects to the view model:
And finally here is the view model (I use Prism's NotificationObject class as the base class to get an implementation of INotifyPropertyChanged):
Add a TriggerAction for Showing Confirmation Message
System.Windows.Interactivity defines a class TriggerAction<T> which we can use to provide a mechanism for adding the confirmation message in XAML. The code is quite simple:
We use an event trigger (mechanism defined in the Expression SDK) to access our TriggerAction in XAML:
Yesterday, I did a session at the .NET Stammtisch Linz. I spoke about latest Docker developments relevant for .NET developers. I focused on new features in Visual Studio and .NET base images available in the Docker Hub for .NET Core and .NET Framework 4.7. In this post I share a recording of my session. Take a look if you want to hear me speaking in my native Upper Austrian dialect ;-)
Recently, I have been doing some conference sessions about C# 7. My next talk in that series will be at Techorama in Belgium tomorrow. In this blog post I summarize the talk and share the samples I will do.
Time Cockpit Newsletter
Thanks for your registration! You are almost finished. We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.