In this post for WPF interview Questions; we have compiled a list of most asked questions that are necessary to learn by aspirants. A deep learning will always help you in cracking your interviews at various MNCs worldwide. The answers for each question are prepared after a careful research and tailored to meet concepts as expected by the interviewer.
Q1). What is WPF?
WPF or Windows Presentation Framework is the successor of Windows forms. This framework is majorly needed for developing Windows-based applications. The framework is utilizing DirectX technology to render controls on the screen.
Q2). What are the features of WPF?
The major features of WPF Framework include –
Q3). Name a few WPF assemblies. Q4). Explain the WPF architecture in brief. We will be discussing each of the managed layer assemblies and unmanaged layer assemblies one by one in later questions.
Q5). How WindowsBase assembly is used in WPF?
The WindowsBase assembly contains four important types of WPF objects –
Q6). How PresentationCore assembly is used in WPF?
This assembly lists the visual classes where all visual controls are inherited in WPF. This assembly further interacts with MilCore assembly for rendering the visual systems.
Q7). How WindowsCodec assembly is used in WPF?
This assembly is needed to play around images. Everything related to images like rendering, transformation, or scaling is done using WindowsCodec assembly.
Q8). How MilCore assembly is used in WPF?
This assembly interacts with DirectX straightforward and rendering visual system for WPF too. DirectX in WPF is further needed for hardware or software rendering in WPF.
Q9). Explain the hierarchy of WPF classes in brief.
Button -> Control -> Framework Element -> UI Element -> Visual -> Dependency Object -> Dispatcher Object -> Objects
Q10). Which type of document controls are supported in WPF?
These are Fixed Document Controls and the Flow Document Controls.
Q11). If you wanted to use 3D in WPF then which namespace is vital?
“System.Windows.Media.Media3D” namespace can be used to render 3D images or media files in WPF.
Q12). Name the class that can be used to convert the string instances to and from instances of Brush.
This is “BrushValueSerializer” class.
Q13). How WPF and WinForms are different?
|1). This is an advanced version tuned with fine technology standards. 2). WPF is built from scratch only and it does not rely on Standard Windows Controls completely. 3). The platform is using multiple new apps like Visual Studio or more. 4). This is more flexible. 5). Here, you can do multiple tasks without writing any new controls.||1). This is an older version tested or verified by developers. 2). WinForms relies on Standard Windows Controls. Example – Textbox. 3). Here, third-party integrations are common to add extra functionality to your current application. 4). Here, most of the work you have to complete yourself.|
Q14). What is XAML in WPF?
XAML language is based on XML and it is used for writing WPF UI elements. XAML elements can be mapped directly with Dotnet objects.
Q15). Do XAML code after compilation is converted to assembly code?
Yes, it is converted and stored as BAML (Binary Application Markup Language) into the assembly.
Q16). How will you define the Dependency Property in WPF?
This is a special property that could participate in DPS (Dependency Property System). It is computing values from multiple inputs at the runtime. The property can be defined with the help of different parameters in WPF like data binding, styling, inheritance, or animation etc.
Q17). How the vales for Dependency Property can be validated?
Here, you can define the callback and get the notification whenever it changed. If the value of callback function is true then it is valid otherwise not authentic.
Q18). How can you define the default values for Dependency Property?
In the property metadata object, you can define the default values for Dependency Property.
Q19). Define the Attachment Property in WPF.
The attachment property is a special category of Dependency Property that can be declared in one class used in another class. Grid.Row, Grid.Column are the perfect example of attach properties in WPF.
Q20). How will you differentiate the attach and Dependency Property in WPF?
There is only a single difference between the two, dependency property is used for a single class only where it is defined while attach property can be used for the defined class and the attached class too.
Q21). Define the significance of Resource Dictionary in WPF.
Resource Dictionary is a special dictionary class where we can store styles, control templates, data templates and a plenty of resources for the later use. IT can be compared with the CSS in HTML. This class will inherit the properties from the Dictionary class and we can always store the resources as the key-value pair.
Q22). How WPF, Silverlight, WPF XBAP, and Ajax.net are different? Q23). Can we design web-based app in WPF without XAML as well?
Yes, of course, you can.
Q24). Define the meaning of path animation in WPF.
Path animation can be defined as the animation timeline where the input is the path geometry.
Q25). Name different types of windows in WPF.
These are the Normal Window, Navigation Window, and the Page Window.
Q26). Name the different types of layout panels in WPF.
These are Canvas, Grid, Uniform Grid, Wrap Panel, Dock Panel, or Stack Panel etc.
Q27). What are the methods used by the data objects in WPF?
These are GetData, SetData, GetFormats, or GetDataPresent etc.
Q28). What are the standard file formats supported by the WPF framework?
These are the bitmap, HTML, CSS file, RTF< String, Text, or Audio formats etc.
Q29). What is BAML and how is it different from the XAML?
BAML stands for Binary Application Mark up Language. This is tokenized XAML that is processed in binary form and much quicker when compared to the XAML.
Q30). What is the significance of graphics in WPF framework?
Q31). What is the importance of TreeView class in WPF?
A TreeView Class is used to present the hierarchical collection of labeled items and each of them is indicated by the TreeNode.
Q32). How content alignment is performed in WPF?
The content alignment is performed through various properties in WPF like Horizontal content control, Vertical Content control etc. These properties are defined in the WPF controls by default.
Q33). What is the basic syntax for defining resources in WPF?
There are two types of resources in WPF – Static resources and Dynamic Resources. The basic syntax for defining resources in WPF could be given as –
Q34). What is the basic syntax for static resources in WPF?
The value of static resources is calculated at the load time. The basic syntax for static resources in WPF could be given as –
Q35). What is the basic syntax for dynamic resources in WPF?
The value of dynamic resources is calculated at the runtime. The basic syntax for dynamic resources in WPF could be given as –
Q36). What is a value converted in WPF?
A value converter acts as the bridge between the target and the source and it is necessary to define when the target is bounded with some source at a particular instance like text control or button controls etc. when you wanted to convert the string to Boolean values, here you need the value converter.
Q37). What is Model-View View-Model in WPF?
MVVM is a framework in WPF that is used for making apps and works similar to MVC architecture. This is 3-tier architecture and we can do loose coupling too with MVVM.
Q38). What is command pattern in WPF?
A command pattern is a powerful design pattern in WPF that is object-oriented and designed to perform a specific action. The members of a command design pattern in WPF include - Client, Invoker, Command, Concrete Command, Receiver etc.
Q39). What is data binding in WPF and how is it performed?
Data binding is one of the amazing features in WPF where simple data binding is used for displaying single values and complex data binding is used for displaying a bunch of data. With XAML, data binding is much easier with the help of different elements, objects, properties etc.
Q40). How PresentationFramework assembly is used in WPF?
This assembly contains the UI controls like Label, TextBlock, TextBox, CheckBox, DataGrid, or ListView etc.
JanBask Training is a leading Global Online Training Provider through Live Sessions. The Live classes provide a blended approach of hands on experience along with theoretical knowledge which is driven by certified professionals.
Dotnet Upcoming Batches