Skip to main content

WPF Interview Questions?

What is WPF?
WPF stands for Windows Presentation Foundation. It is an application programming Interface for developing rich UI on Windows API and WINfx. WPF is introduced in .NET 3.0. By the use of WPF we can
  • Capabilities to HTML and flash.
  • Has all equivalent common user controls like buttons, check boxes   sliders etc.
  • Fixed and flow format documents 
  • 2D and 3D dimensional  graphics 
  • Multimedia 
  • Data binding

What Is XAML?

XAML (Extensible Application Markup Language) is a XML based language used to create rich GUI’s.

  • It supports both vector and bitmap images
  • XAML is a new markup language which is used for defining UI elements and its relationships with other UI elements.
  • XAML is a XML document which defines objects and properties and WPF loads this document in actual memory.
  • Using XAML, you can create any kind of objects that means graphical or non-graphical.
  • XAML is a declarative XML-based language by which you can define object and properties in XML
  • XAML document is loaded by a XAML parser. XAML parser instantiates objects and set their properties. XAML describes objects, properties and there relation in between them. WPF parses the XAML document and instantiates the objects and creates the relation as defined by XAML.

What are the core WPF assemblies?

The core WPF assemblies are,
WindowsBase.dll:- This is the core types constituting the infrastructure of WPF API.

PresentationCore.dll:- It defines numerous types constituting foundation of WPF GUI layer.

PresentationFoundation.dll:- It defines WPF control types, animation & multimedia support, data binding support and other WPF services.

  Besides these three libraries WPF also uses an unmanaged binary called milcore.dll which acts as a bridge between WPF assemblies and DirectX runtime layer.

What are the types of triggers available in WPF?

Triggers define a list of setters that are executed if the specified condition is fulfilled. WPF knows three diferent types of triggers
  • Property Triggers get active, when a property gets a specified value.
  • Event Triggers get active, when a specified event is fired.
  • Data Triggers get active, when a binding expression reaches a specified value.
What is dependency property?

WPF elements are classes with methods, properties and events. Nearly every property of a WPF element is a dependency property. Dependency properties are used with databinding, animation, resources and styles.
Only a class that derive from base class DependencyObject can include dependency properties.

What is attached property in WPF?

These are dependency properties that belong to one class but can be used in another.

Consider the below code

<Rectangle Height="72" Width="131" Canvas.Left="74" Canvas.Top="77" />

Height and Width are regular properties of the Rectangle. But Canvas.Top and Canvas.
Left is dependency property as it belongs the canvas class. It’s used by the Rectangle to
specify its position within Canvas.

 

Readonly Dependency Properties

Some dependency property of WPF controls are readonly. They are often used to report the state of a control, like the IsMouseOver property. Is does not make sense to provide a setter for this value.

What is a Routed event?

In a typical WPF application, it contains many elements. These elements exist in an element tree relationship with each other. A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.
Routed events are events which navigate up or down the visual tree according to their RoutingStrategy.
You can hook up event handlers on the element that raises the event or also on other elements above or below it by using the attached event syntax: Button.Click="Button_Click". Routed events normally appear as pair. The first is a tunneling event called PreviewMouseDown and the second is the bubbling called MouseDown. They don't stop routing if the reach an event handler. To stop routing then you have to set e.Handled = true;

Tunneling The event is raised on the root element and navigates down to the visual tree until it reaches the source element or until the tunneling is stopped by marking the event as handeld. By naming convention it is called Preview... and appears before corresponding bubbling event.
Bubbling The event is raised on the source element and navigates up to the visual tree until it reaches the root element or until the bubbling is stopped by marking the event as handled. The bubbling event is raised after the tunneling event.
Direct The event is raised on the source element and must be handled on the source element itself. This behavior is the same as normal .NET events.

Which type of documents supported by WPF?
WPF supports two types of documents,
  • Fixed Format Documents
  • Flow Format Documents 
Fixed format document is like PDF. It displays contents regardless of screen resolution and size.
 
Flow format document adjust content with respect to screen resolution and size

What are the panels in WPF?

1.CANVAS - Explicitly positioning of controls
2.DOCKPANEL - Similar to windows form docking application
3.GRID - Can arrange child controls with rows and columns
4.STACKPANEL - Used to organize child controls either horizontally or vertically
5.WRAPPANEL - Can arrange child controls from left to right one after the other as long as they fit in to next line



Comments

Popular posts from this blog

Connected and disconnected architecture in ADO.Net with Example

Connected Architecture of ADO.NET The architecture of ADO.net, in which connection must be opened to access the data retrieved from database is called as connected architecture. Connected architecture was built on the classes connection, command, datareader and transaction.  Connected architecture is when you constantly make trips to the database for any CRUD (Create, Read, Update and Delete) operation you wish to do. This creates more traffic to the database but is normally much faster as you should be doing smaller transactions. Disconnected Architecture in ADO.NET The architecture of ADO.net in which data retrieved from database can be accessed even when connection to database was closed is called as disconnected architecture. Disconnected architecture of ADO.net was built on classes connection, dataadapter, commandbuilder and dataset and dataview. Disconnected architecture is a method of retrieving a recor

HTTPHandler and HTTPModule in ASP.NET

If you want to implement pre-processing logic before a request hits the IIS resources. For instance you would like to apply security mechanism, URL rewriting, filter something in the request, etc. ASP.NET has provided two types of interception HttpModule and HttpHandler .   The web server examines the file name extension of the requested file, and determines which ISAPI extension should handle the request. Then the request is passed to the appropriate ISAPI extension.  For Example When an .aspx page is requested it is passed to ASP.Net page handler. Then Application domain is created and after that different ASP.Net objects like Httpcontext, HttpRequest, HttpResponse. HTTPModule: -    It's just like a filter. The Modules are called before and after the handler executes . -    HTTP Modules are objects which also participate the pipeline but they work before and after the HTTP Handler does its job, and produce additional services within the pipeline -  

ASP.NET Page Life Cycle with example

In this article, we are going to discuss the different methods and order they are executed during the load of an .aspx web page. Methods Description Page_PreInit Before page Initialization Page_Init Page Initialization LoadViewState View State Loading LoadPostData Postback Data Processing Page_Load Page Loading RaisePostDataChangedEvent PostBack Change Notification RaisePostBackEvent PostBack Event Handling Page_PreRender Page Pre Rendering Phase SaveViewState View State Saving Page_Render Page Rendering Page_Unload Page Unloading PreInit : The entry point of the page life cycle is the pre-initialization phase called “PreInit”. You can dynamically set the values of master pages and themes in this event. You can also dynamically create controls in this event.  Init : This event fires after each control h