Sunday 26 February 2017

WPF interview question Part 2

1. Ques: What are the common assemblies used in WPF?
Answer:
 WPF has three common assemblies. These are as below,
  • WindowsBase.dll:- This assembly defines the core types that constitute the infrastructure WPF API.
  • PresentationCore.dll:- As the name specifies this assembly specifies different types for WPF GUI layer.
  • PresentationFoundation.dll:- It defines the WPF control types, animation, multimedia and data binding support. It also specifies some other functionality. 

2. Ques: What are Freezable objects in WPF ?
Answer:
.NET 3.5 introduces a new type of objects called freezable objects. An object, which has its state locked down, so that it becomes unchangeable, is known as a freezable object. These objects are usually related to graphics sub-system. A freezable object has two states – frozen and unfrozen. When an object is frozen, it cannot be modified and it cannot even fires events but the unfrozen state, it works same as a normal object. Such objects perform better. It is also safer if they are required to be shared between threads.
Some freezable objects are – Brush, Pen, Geometry, Transform, and AnimationTimeline.


3. Ques: What are important Namespace in WPF ?
Answer:
The major subsystems are:
  • System.Windows:- It is the core namespace of WPF. You will find all the base classes such as, Application, DependencyObject , DependencyProperty and FrameworkElement here.
  • System.Threading.DispatcherObject: Most of the WPF classes derive from the DispatcherObject object to provides the Thread-Safe environment.
  • Windows.FrameworkElement: It is a base class that is inherited by all of the layout controls and other WPF Controls. FrameworkElement provides functionality related to the logical tree, styling, data binding and lifetime events.
  • System.Windows.Controls:- This namespaces contains all the controls of WPF. You will also find classes to work with complex controls such as PopUp, ScrollBar, StatusBar, TabPanel, etc. as well as all the basic controls.
  • System.Windows.Data:- This namespace is used by WPF for Data Binding. 
  • System.Windows.Input:- This namespace provides several classes for command handling, keyboard input, etc.
  • System.Windows.Markup:- This namespace helper classes for XAML markup code.
  • System.Windows.Media:- This namespace is responsible to work with images, audio, and multimedia.
  • System.Windows.Shapes:- This namespace provides core classes for UI such as Line, Rectangle, Ellipse, etc. 
  • System.Windows.Threading:- This namespace provides classes to work with multiple threads. 
  • System.Windows.Navigation:- This namespace provides classes for navigation between WPF pages particularly when working with Web Applications.
  • System.Windows.UIElements:- UIElement is a base class for most of the objects that have visual appearance and can process basic input.

4. Ques: What are Attached Properties in WPF ?
Answer:
Attached properties are a special kind of DependencyProperties. They allow you to attach a value to an object that does not know anything about this value.
For example, if the button element is located inside a Canvas element. the button has Top and Left properties that are prefixed with the parent element's name. Such a property is known as attached property.

5. Ques: What is ObservableCollection?  What are the uses of ObservableCollection.
Answer:
An ObservableCollection is a dynamic collection of objects of a given type. Objects can be added, removed or be updated with an automatic notification of actions. When an object is added to or removed from an observable collection, the UI is automatically updated. This happens because, when binding to an observable collection, WPF automatically adds a CollectionChanged event handler to the ObservableCollecion's events.

The ObservableCollection class exists in the System.Collections.ObjectModel namespace.

One of the biggest uses is that you can bind UI components to one, and they'll respond appropriately if the collection's contents change. For example, if you bind a ListView's ItemsSource to one, the ListView's contents will automatically update if you modify the collection.

6. Ques: How many types of Documents are supported by WPF ?     
Answer:   
WPF supports two types of documents
Fixed format Document -It is just like PDF Format. they display content regardless of screen size and resolution.
Flow format Document. -It adjust depending on screen size and resolution.


7. Ques: What are the types of windows in WPF?
Answer:   
WPF has three types of windows:
  • Normal Window
  • Page Window
  • Navigate Window

8. Ques: What are the advantage of using XAML?
Answer:   
The advantage of using XAML are given bellow
  • XAML code is clear to read, and they are short
  • Separation of designer code and logic
  • Tools like expression blend used for graphical design require XAML as source
  • It clearly separates the roles of designer and developer

9. Ques : What are the different types of brushes that WPF offers?
Answer:   
There are six different types of brushes

  • SolidColorBrush
  • LinearGradientBrush
  • RadialGradientBrush
  • DrawingBrush
  • VisualBrush
  • ImageBrush

10. Ques : Question:What are Templates and its type in WPF?
Answer:   
A Template is used to change how a control looks.
Types of templates:
Control template: How a control is rendered and behaves by specifying the visual structure and behavioral aspects.
Data template: To specify the visualization of data objects.
Hierarchical data template: Used over hierarchical structure like Tree View and Menu.

No comments:

Post a Comment

Thank you for comment