Skip to main content

Posts

PopUps with Interactivity using ConfirmationRequest [Prism 5.0]

In continuation to my previous blog on PopUps with Interactivity , here we will see how to implement IConfirmation request. In order to make this post short, I'll implement IConfirmation request on top of previous example.  Let's open our viewModel and add property for InteractionRequest of type IConfirmation  as: public InteractionRequest<IConfirmation> ConfirmationRequest { get; set; } Now for every getter/setter we should have a corresponding command, which will help us in invoking this request: public ICommand ConfirmationCommand { get; set; } Just like NotificationRequest, we need to create instances of these objects in constructor as: If you will see above snippet closely, you will notice that in case of Confirmation, we are handling Status in slight different manner. Next step is to update our View as we did for NotificationRequest. Now everything is in place. Let's quickly run the application and click on PopUp button:...

PopUps with Interactivity using NotificationRequest [Prism 5.0]

Just about every application has a need to notify user about an event or ask for confirmation before proceeding onto the next operation. Prior to MVVM, we would have used the MessageBox class in the code-behind. But for MVVM applications, that’s not the appropriate way as it breaks the separation of concerns from the view or viewmodel. There are lots of ways to show popups in MVVM application. In Prism, we just happen to use triggers. Triggers Triggers are used to initiate actions when a specific event is raised. So, it means we have to setup a view to detect the interaction request of event and then present an appropriate visual display for that request. What is required for raising events? Now for raising events, we need an event trigger. But not just any event trigger. We don’t want to use the built-in event trigger, instead Prism provide its own InteractionRequestTrigger. This trigger binds to the source object or the InteractionRequest object that exist in your viewm...

Introducing Windows 10

Hope most of you are aware that in the mid of last week, Microsoft announced Windows 10 (Technical Preview).  This preview is a small set of new code and is not the final one. It means lot more is on the way :) This release contains desktop-focused features, primarily for business customers. Actual consumer preview is plan to launch somewhere around January. Windows 10 will run across unbelievably broad set of devices from 4 inch screens to 80 inch screens. Some of the devices we can hold in hand and others are 10 feet away. So, are you ready to dive into the new features? Well, let's start. Start Menu: Start menu with Live tiles and favourite apps Everything runs in a window: Windows store apps now opens in the same fashion as desktop apps format – can be re-sized and move around – have title bars Snap Enhancements: New quadrant layout to view four snapped apps in single shot M...

What's New In Prism 5.0?

Are you WPF, Silverlight or Windows Phone developer and used Microsoft’s patterns and practices library to build your applications? If you are, then you might want to know that Microsoft’s patterns and practices team have just released Prism 5.0. All the applications built using the previous versions of Prism are now broken. So, in this artifact, I’ll be discussing about the new assemblies, new objects and deprecated objects which can/can’t be used with Prism 4.1 and Prism 5.0. Downloading Prism 5.0 Prism 5.0 can be downloaded and installed either from patterns and practices site having URL as http://compositewpf.codeplex.com/ or by using Nuget package inside Visual Studio. Mentioned link also discusses about all the changes which are part of Prism 5.0 Supported Platforms Let’s have a quick look at the supported platforms of Prism 5.0. While working with previous versions of Prism (i.e. 4.1), one was able to create applications like WPF (.Net 4.0), Silverlight 5 and Window...

Propagating Property Change for Static Properties

While working on any XAML based app, first thing which comes into mind is Binding . There are lot many articles on what is Binding and how it works. Don’t worry, I am not going to repeat all that stuff again. But definitely, I would like to touch upon few things which are base of my today’s write-up. To make any property bindable or let’s say to propagate property change, we usually follow one of the below two options: Implement INotifyPropertyChanged interface or Create an event with name PropertyNameChanged Point to notice here is, both the above options will work only on instance properties. Now what if my property is Static??? INotifyPropertyChanged is not going to work for static properties. None of the above options will make x:Static extension work. What to do now ? No worries, all these hazards can easily be overcome when you will jump to .Net 4.5. Approach 1: Property specific static event for each and every static property Let’s have a look a...