Tuesday, May 23, 2017
WPF interview Questions
Object: - As WPF is created using .NET so the first class from which WPF UI classes inherits is the .NET object class.
Dispatcher: - This class ensures that all WPF UI objects can be accessed directly only by the thread who own him. Other threads who do not own him have to go via the dispatcher object.
Dependency: - WPF UI elements are represented by using XAML which is XML format. At any given moment of time a WPF element is surrounded by other WPF elements and the surrounded elements can influence this element and this is possible because of this dependency class. For example if a textbox surrounded by a panel, its very much possible that the panel background color can be inherited by the textbox.
Visual: - This is the class which helps WPF UI to have their visual representation.
UI Element: - This class helps to implement features like events, input, layouting etc.
Framework element: - This class supports for templating , styles , binding , resources etc.
And finally all WPF controls textbox , button , grids and whatever you can think about from the WPF tool box inherits from the framework element class.
No, WPF does not replace DirectX. DirectX will still be still needed to make cutting edge games. The video performance of directX is still many times higher than WPF API. So when it comes to game development the preference will be always DirectX and not WPF. WPF is not an optimum solution to make games, oh yes you can make a TIC TAC TOE game but not high action animation games.
One point to remember WPF is a replacement for windows form and not directX.
No,XAML is not meant only for WPF.XAML is a XML-based language and it had various variants.
WPF XAML is used to describe WPF content, such as WPF objects, controls and documents. In WPF XAML we also have XPS XAML which defines an XML representation of electronic documents.
Silverlight XAML is a subset of WPF XAML meant for Silverlight applications. Silverlight is a cross-platform browser plug-in which helps us to create rich web content with 2-dimensional graphics, animation, and audio and video.
WWF XAML helps us to describe Windows Workflow Foundation content. WWF engine then uses this XAML and invokes workflow accordingly.
A - Anywhere execution ( Windows or browser application)
B - Bindings ( less coding)
C - Common look and feel ( resource and styles) -- one style can be bind to all text box
D - Declarative programming (XAML)
E - Expression blend animation ( Animation ease)
F - Fast execution ( Hardware acceleration)
G - Graphic hardware independent ( resolution independent)
static resource declared in xaml while dynamic resource can be set from code behind.
Dynamic resources reduce application performance because they are evaluated every time the resource is needed. So the best practice is use Static resource until there is a specific reason to use dynamic resource. If you want resource to be evaluated again and again then only use dynamic resource.
Separation of concern: -
Increased UI Reusability:
Automated UI Unit testing: