WPF or Windows Presentation Foundation is a Graphic related task that displays user interfaces, images, movies, etc. Every year, .NET and such other interviews are held to fill up the vacancies with the good pay scale. This field is like the ocean where anything can be asked for the interview. Here, is a set of twenty questions that will give an idea of what to expect for your WPF interview. There is no less or more preparation for this particular interview. So, all you have to do is start with basics and then move on to the complex ones. These questions will help you understand the pattern of the interview that will get you mentally prepared for the big day. It’s not just about being physically prepared, but you have to be mentally prepared as well. So let’s start with questions and their answers that have a higher probability to be asked by the interviewer.
WPF denotes Windows Presentation Foundation, which is a re-invention of a UI that uses WPF for Desktop applications. Just like other developers have been doing all this while, other than dropping controls on “Windows Forms,” WPF is known to provide an extra rapid boost to the application development including animation, Rich User Interface, and much more.
To summarise it all, following things can be done using WPF:
Advantages of WPF are:
In WPF, various properties are used while dealing with the content of content controls. The two properties are as follows:
# Horizontal Content Alignment, and
# Vertical Content Alignment
The parent class of all controls in WPF defines all the properties in System.Windows.Controls.Control class that is.
If we create a TextBox control and a UI with a Button, the UI looks like the following figure where the default vertical and horizontal alignment of the content of a Button is center. The default horizontal and vertical alignment of the content of a TextBox is left and top.
A Value Converter is known to function as a bridge between a source and a target that is necessary when a target is bound with one source, for example, if you have a text box then you also has a button control. You want to disable or enable or disable the button control when the text of the text box is null or filled.
Sometimes the string data needs to be converted into Boolean. This is only possible when using a Value Converter. For implementing Value Converters, it requires you to inherit from I Value Converter in the System.Windows.Data namespace and then implement the two methods Convert Back and Convert.
You may note that in WPF, binding helps in the flow of data between the two WPF objects. The bound object that emits the data is called the Source, and the other (that accepts the data) is called the Target.
The need for WPF can be better be understood with A-G that is,
There are two types of resources:
We should use the Static Resource markup extension to define the resource as a static resource. The value of Static Resource is determined at the time of loading.
Dynamic Resource is used in a situation where the value of the property needs to be changed at runtime.
Prism is also known as Composite Application Guidance for WPF and Silverlight. It is a framework that can be used to build Silverlight apps and WPF. It has been designed to build solid applications in Silverlight and WPF that normally have a single code base. It is helpful in developing a client application, which is in a modular fashion. It is done so to divide large, complex applications into simple modules. The actual definition of a Prism being
“ Prism is developed by Microsoft Patterns and Practices and provides guidance designed to help you to more easily design and build rich, flexible and easy-to-maintain Windows Presentation Foundation (WPF) desktop applications. ”
it was initially called Prism but later on, Microsoft named it as ‘CompositeWPF’.
In WPF, templates are a very important part of user interface design. The three main types of templates of WPF are:
To blend expression in a Visual Studio
Some common localization or globalization practices for localizing or globalizing WPF are:
1) Use Resources.resx,
2) Use BAML,
3) Use a Resource Dictionary to manage localizable strings.
A Routed Events is all about the Hierarchy of the controls that are used by us in the Events. Routed Events are known to be a new Infrastructure that is given by WPF that permits events to go tunneling down the tree to the target elements or Bubble up to the Root element. Events are simply like normal events. Types of routed events
Basically Routed Events are of mainly three types that are as follows:
As the name suggests, Rotate transform rotates the element, by a specific angle clockwise about a point. The rotate transform is represented by the Rotate Transform object in WPF. The angle in degrees to be rotated clockwise is known as Angle property of RotateTransform. The center Y and CenterX represent the Y and X coordinates of the center point. The ScaleTransform is centered at the point (0,0) that corresponds to the upper-left corner of the rectangle, which is by default in nature.
To improve the rendering performance of UI elements the Virtualization technique in WPF is used. By using Virtualization technique the layout system ensures that the only items visible of a container are rendered on the screen. Like for instance, if a list control has thousands of items, the virtualization technique will reduce the rendering to just visible items.
If you are planning to build a localized or globalized application.
In AutoCAD, Polyline is an object, which consists of one or more than one line or arc in segments. To define it, a polyline is a collection of connected straight lines. The Polyline object represents a polyline shape and draws a polyline with the given points. The Points property represents the points in a polyline. The Stroke property sets the color and StrokeThickness represents the width of the line of a polyline.
Some of the possible options for the controls available are;
It is important to make sure that the ListView and ListBox can be selected when ItemsControl is not supporting a selection. You must also know that a ListView is more feature rich as it inherits ListBox that inherits ItemsControl and then adds features. You must also make sure that they understand the importance of DataGrid and how it is different from rest and why they must display a list in a DataGrid.
When you are planning to make applications in WPF, then you need framework named Model View View Model or MVVM. It is same as the MVC framework and has a 3-tier architecture with one more layer. We can do loose coupling using MVVM.
MVVM was originally introduced by John Gossman in the year 2005 specifically for use with WPF as a concrete application of Martin Fowler’s broader Presentation Model pattern. The implementation of an application, Based on the MVVM patterns the implementation of an application uses different platform capabilities that are available in some form for WPF, Silverlight Desktop/web, and on Windows. Many commercial applications, including Microsoft Expression products, were built following MVVM.
In WPF, one of the most fundamental controls is the TextBlock control that comes in very handy. It is used to put text on the screen, very much like using the Label control, but in a much less resource demanding and simpler way. Both the TextBlock and Label, offer their unique advantages, so the situation demands what you may use at one particular time.
Sometimes, there arises a need to perform the same activity, for that purpose WPF provides us with a feature called Command to make our work faster and easier. A Command is called on for several purposes. First of all, it is used to separate the semantics from the object that calls upon a command from the logic that executes a particular command.Commands are also used to share grouped actions inside an application in various ways.
There are mainly four types of Command:
When you want to represent a data in a hierarchical view, which is in a parent-child relationship and where a parent node can be collapsed or expanded than a TreeView is called into the scene.The left sidebar of Windows Explorer is a good example of the TreeView.A WPF TreeView control in XAML is represented by the TreeView tag.
In WPF, the AccessText control is used to convert a character that is preceded by an underscore to an Access Key. The Access Key is registered and therefore used to raise an event when pressed.
Never Miss an Articles from us.