WPF Interview Questions and Answers
Question - 61 : - When did MVVM introduced?
Answer - 61 : -
MVVM was introduced by John Gossman in 2005. It was introduced specifically to use with WPF as a concrete application of Martin Fowler's broader Presentation Model pattern.
Question - 62 : - What are the advantages of MVVM?
Answer - 62 : -
MVVM has the following advantages:
- Modularity
- Test driven approach.
- Separation UI and Business layer as view and view model.
- Code sharing between pages and forms.
- Easy to Maintain.
Question - 63 : - What are the most important features of MVVM?
Answer - 63 : -
A list of most important features of MVVM:
- MVVM separates the business and presentation layers, like MVP and MVC.
- It improves Structure/separation of concerns (View, ViewModel and Model).
- It enables a better Design/Developer Workflow.
- It improves simplicity and testability.
- It is enabled by the robust data binding capability of XAML.
- No need to use a code behind file (minimalist code-behind file).
- Provides application development ability for multiple environments.
- Powerful Data Binding, command, validation and much more.
- The designer and developer can work together.
Question - 64 : - What are the various layout panels in WPF?
Answer - 64 : -
They are:
- Stack Panel
- Grid Panel
- Canvas Panel
- Dock Panel
- Wrap Panel
Question - 65 : - Name the important subsystems in WPF
Answer - 65 : -
The major subsystems are:
- Windows.Controls.Control
- Windows.DependancyObject
- Windows.FrameworkElement
- Windows.Media.Visuals
- Object
- Threading.DispatcherObject
- Windows.UIElements
Question - 66 : - What does BAML mean in WPF?
Answer - 66 : -
BAML is the abbreviation for Binary Application Markup Language. It is nothing but XAML that has been tokenized, parsed and changed into binary form. BAML is a compressed declarative language, which gets loaded and parsed quicker than XAML.
Question - 67 : - What is Difference between Page and Window Controls in WPF?
Answer - 67 : -
The basic difference is that Window Control presides over Windows Application while Page Control presides over the hosted Browser Applications. Also, Window control may contain Page Control, but the reverse cannot happen.
Question - 68 : - What are Attached Properties in WPF?
Answer - 68 : -
Attached properties are basically Dependency Properties that allows the attachment of a value to any random object.
Question - 69 : - What is the INotifyPropertyChanged Interface?
Answer - 69 : -
The InotifyPropertyChanged notifies clients, generally those who are binding, if the value of a property gets changed. It has an event, called PropertyChanged, which gets raised everytime a property of Model object is changed.
Question - 70 : - What is the basic difference between Events and Commands in the MVVM Model?
Answer - 70 : -
Commands are more powerful and are advantageous to use instead of events. Actions are deeply connected with the event’s source and, therefore, the events cannot be reused easily. But commands make it possible to efficiently maintain multiple actions at one place and then reuse them as per our requirement.