WPF Interview Questions and Answers
Question - 31 : - Write down the syntax for resources in WPF.
Answer - 31 : -
Syntax:
Here,
elementName: Name of the element that uses the resource.
propertyName: Name of the property that takes its value from the resource.
markupExtension: Define type of resource.
keyName: key name of the resource, which is unique string to identify the resource.
Question - 32 : - How many types of resources available in WPF?
Answer - 32 : -
There are mainly two types of resources in WPF:
- Static Resource
- Dynamic Resource
Question - 33 : - Write about PRISM.
Answer - 33 : -
PRISM is a framework for creating complex applications for WPF, Silverlight or Windows Phone. PRISM utilizes MVVM, IC, Command Patterns, DI and Separation of Concerns to get loose coupling.
Question - 34 : - Is it possible to use Windows Forms in a WPF application?
Answer - 34 : -
Yes, Windows form can be used in WPF. Windows form can appear as a WPF pop. The controls of this Window form can be placed besides WPF controls in a WPF page by utilizing the functions of the WindowsFormsHost control that comes preinstalled.
Question - 35 : - Describe CustomControl briefly.
Answer - 35 : -
CustomControl widens the functions of existing controls. It consists of a default style in Themes/Generic.xaml and a code file. It is the best way to make a control library and can also be styled or templated.
Question - 36 : - Name the common assemblies used in WPF?
Answer - 36 : -
- PresentationFoundation
- WindowsBase
- PresentaionCore
Question - 37 : - Define Path animations in WPF
Answer - 37 : -
Path animation is a type of animation in which the animated object follows a path set by the Path geometry.
Question - 38 : - Can WPF applications be made without XAML?
Answer - 38 : -
Yes WPF applications can be created without XAML as using XAML in WPF is a matter of choice.
Question - 39 : - What are the types of windows in WPF?
Answer - 39 : -
WPF has three types of windows:
- Normal Window
- Page Window
- Navigate Window
Question - 40 : - How can elements in a ListBox be sorted?
Answer - 40 : -
Sorting can be done by using a property of the ItemsCollection object. ItemsCollection contains an attribute, SortDescriptions, which holds System.ComponentModel.SortDescription instances. Every SortDescription instance defines how the elements should be sorted and indicates if the sort is descending or ascending.
For instance, this code sorts elements of ContentControl on the basis of their word count property:
myItemsControl.Items.SortDescriptions.Add(new SortDescription(“WordCount”, ListSortDirection.Descending));