*
Previous WPF-Question-Answers-61-70 C# Threading QA-41-50 Next

WPF (Windows Presentation Foundation) Question Answers - (71–80)

WPF Interview Questions (71 - 80)

71. What is the difference between collection and observable collection?

ObservableCollection implements INotifyCollectionChanged interface, which allows to update the UI on any updates to the collection. ObservableCollection does not have AddRange method.

72. What is the difference between KeyBinding and MouseBinding?

KeyBinding allows you to define gestures for commands that consist of a keystroke possibly combined with one or more modifiers, whereas MouseBinding allows you to define gestures for the mouse that can also be optionally combined with modifiers on the keyboard.

73. What is the Difference between TextBlock and Label in WPF?

TextBlock:

  • TextBlock is lightweight than the Label.
  • TextBlock is not a control.
  • It derives directly from FrameworkElement.

Label:

  • Label is much heavier than TextBlock.
  • Label derives from ContentControl.
  • Label text is greyed out when disabled.
  • Label supports access keys.
  • It can display data other than a string via the content Property.
  • Can apply a DataTemplate to its content via the ContentTemplate property.
  • Can be given a custom control template via the Template property.

74. What is the difference between WCF and WF?

Windows Communication Foundation is focused on messaging. This API greatly simplifies all sorts of networking and communication tasks. It covers everything from web services to remoting to P2P and more.

Windows Workflow Foundation is a powerful library for building workflow-enabled applications. It utilizes a markup language for declaring workflows in an application, preventing workflows from becoming hard-coded and making it easy to create custom workflow tasks.

75. What is the difference between xmlns and xmlns:x in WPF?

"xmlns" defines a namespace in which to resolve XML element names and is defined without a qualifier.

"xmlns:x" defines a namespace with qualifier 'x'. If we want an element or attribute name to be resolved within this namespace, we should qualify it with 'x'.

Example:

<StackPanel x:Name="MyFirstStack" />

StackPanel is resolved in the default WPF namespace. x:Name is resolved within the XAML document namespace.

76. What are the elements and attributes in XAML?

Object element syntax is the XAML markup syntax that instantiates a CLR class or structure by declaring an XML element.

Declaring an XML element in XAML is equivalent to instantiating the corresponding object via a default constructor. Setting an attribute on the object element is equivalent to setting a property of the same name or hooking up an event handler of the same name.

77. What is the most common format for declaring a data binding in markup?

Markup extensions are the most common means of declaring a data binding. They are identified by the use of curly brackets ({}).

78. What is the need for bindings in WPF?

Data binding is needed in WPF because when the data changes its value, the elements that are bound to the data reflect changes automatically. No need to update the UI separately.

79. What is the Popup control in WPF?

Popup has one content property: Child. A Popup can have a maximum of one child, which can be any UIElement.

A Popup displays its content in its own window on the screen. It supports animation when the AllowsTransparency property is set to true and the application is running with full trust.

A Popup is sized to its content by default.

80. What is the purpose of the x:Name attribute in XAML?

The x:Name attribute allows you to uniquely identify an instance of an object defined in XAML. The value of the x:Name attribute can be referenced in the associated C# or VB code.

Back to Index
Previous WPF-Question-Answers-61-70 C# Threading QA-41-50 Next
*
*