• +91 9723535972
  • info@interviewmaterial.com

WPF Interview Questions and Answers

Related Subjects

WPF Interview Questions and Answers

Question - 81 : - Explain MVVM pattern.

Answer - 81 : -

MVVM pattern divides the UI code into 3 basic parts:

  • Model – It represents a set of classes, which contain data received from databases.
  • View – It is the code that agrees with the visual representation of the data.
  • ViewModel – It is the layer that binds View and Model together. It presents this data in a manner, which is easy to understand. It also controls how View interacts with the application.

Question - 82 : - How to make a ToolTip appear while hovering over a disabled element?

Answer - 82 : -

For this purpose, the ShowOnDisabled property can be used. It belongs to the ToolTipService class.

Question - 83 : - How can ListBox be made to scroll smoothly?

Answer - 83 : -

ListBox is configured to scroll on an item-by-item basis by default. This is dependent on the height of each element and the scrolling action, thus, giving a rough feeling. Better way is to configure scrolling action so that it shifts items by a few pixels irrespective of their height. This is done by setting the ScrollViewer.CanContentScroll property to “false”. This will, however, make the ListBox lose the virtualization property.

Question - 84 : - Where does the execution start in a WPF application?

Answer - 84 : -

WPF applications created in Visual Studio run without a Main method. This is because the applications are special-cased when they are compiled from XAML. That means, Visual Studio attaches a Build Action of ApplicationDefinition to the XAML file. This results in the auto generation of a Main method.

Question - 85 : - Can Windows Service be created Using WPF?

Answer - 85 : -

No, Windows Services cannot be created using WPF. WPF is a presentation language. Windows services need specific permissions to execute some GUI related functions. Therefore, if it does not get the required permissions, it gives errors.

Question - 86 : - What are the different kinds of Routed events in WPF?

Answer - 86 : -

There are three types of Routed events in WPF. They are:

  • Direct – This event can only be raised by the element in which it was originated.
  • Tunneling – This event is first raised by the element in which it was originated and then it gets raised by each consecutive container in the visual tree.
  • Bubbling – This event is first raised by the uppermost container in the visual tree and then gets raised by each consecutive container lying below the uppermost one, till it reaches the element it where it was originated.

Question - 87 : - Why is it better to wrap items in ComboBoxItem?

Answer - 87 : -

It has some important properties like IsSelected and IsHighlighted and also some necessary events like Selected and Unselected. ComboBoxItem is a content control and is thus very useful for adding simple strings to a ComboBox.

Question - 88 : - How to get Automation IDs of items in a ItemsControl?

Answer - 88 : -

The best way to do this is by setting it Name property as it is utilized for automation purposes by default. But if you require to give an ID to an element, other than it’s name, then the AutomationProperties.AutomationID property can be set as per need.

Question - 89 : - How can command-line arguments be retrieved in a WPF application?

Answer - 89 : -

The most preferred method for this is to call System.Environment.GetCommandLineArgs at any random point in the application.

Question - 90 : - State the name of the classes, which contain arbitrary content.

Answer - 90 : -

  • Content Control
  • HeaderedContent Control
  • Items Control
  • HeaderedItems Control


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners