Skip to main content

Posts

Showing posts from 2015

WPF: Simple TimePicker User Control for WPF

Hey Guys! WPF gives us DatePicker but it doesn’t give us TimePicker. I tried to create a very simple TimePicker user control.   And the bumper offer is that it is free. Use it wherever you want. J Hope this will help you a lot.   XAML Code:   < UserControl  x : Class ="Restaurant.Reservations.UserControls.ucDateTimeUpDown"               xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"               xmlns : x ="http://schemas.microsoft.com/winfx/2006/xaml"               xmlns : d ="http://schemas.microsoft.com/expression/blend/2008"               xmlns : mc ="http://schemas.openxmlformats.org/m...

WPF-MVVM: RelayCommand Implementation

In WPF if we are implementing MVVM pattern then we need to play with Command rather than Events. You can use ICommand interface to create each command class. Implementation of ICommand in a class gives you CanExecute(), Execute() methods which take part in the action performed by Command.   Rather than making Command Class for each Command we can implement a generic Relay Command to get Command. Below is a RelayCommand class that we will implement.   ///   <summary>      ///  To register commands in MMVM pattern      ///   </summary>      class   RelayCommands  :  ICommand     {          readonly   Action < object > _execute;          readonly   Predicate < object > _canExecute;  ...