| WPF-Question-Answers-41-50 | WPF-Question-Answers-81-90 | |
WPF (Windows Presentation Foundation) Question Answers - (51–60) |
Dependency properties are properties of classes that derive from DependencyObject, and they're special in that rather than simply using a backing field to store their value, they use some helper methods on DependencyObject. The value of a DependencyProperty is resolved dynamically when calling the GetValue() method that is inherited from DependencyObject. The value of a dependency property is not stored in a field of object, but in a dictionary of keys and values provided by the base class DependencyObject. The key of an entry is the name of the property and the value is the value you want to set.
Properties that belong to a specific class but can be used for another are called the dependency properties. These properties are set through methods such as, styling, data binding, animation, and inheritance.
DependencyObject?
DependencyObject—The base class for any object that can support dependency properties.
DependencyObject services and characteristics include the following:
DependencyObject.You can think of a Style as a convenient way to apply a set of property values to more than one element. WPF styling model is the separation of presentation and logic. Styles also can be inheritable using the 'BasedOn' property.
Styles and Resources: You can use a style on any element that derives from FrameworkElement or FrameworkContentElement. The most common way to declare a style is as a resource in the Resources section in a XAML file.
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontFamily" Value="Comic Sans MS"/>
<Setter Property="FontSize" Value="14"/>
</Style>
Because styles are resources, they obey the same scoping rules that apply to all resources.
Dispatcher class provides services for managing the queue of work items for a thread. It maintains a prioritized queue of work items for a specific thread.
When a Dispatcher is created on a thread, it becomes the only Dispatcher that can be associated with the thread. A Dispatcher is also created when you create a DispatcherObject.
In WPF, a DispatcherObject can only be accessed by the Dispatcher it is associated with. For example, a background thread cannot update the contents of a Button that is associated with the Dispatcher on the UI thread. This is accomplished by using either Invoke or BeginInvoke. Invoke is synchronous and BeginInvoke is asynchronous.
DispatcherObject—The base class meant for any object that wishes to be accessed only on the thread that created it. Most WPF classes derive from DispatcherObject and are therefore inherently thread-unsafe.
FrameworkContentElement—The analog to FrameworkElement for content.
FrameworkElement—The base class that adds support for styles, data binding, resources, and a few common mechanisms for controls, such as tooltips and context menus.
Freezable—The base class for objects that can be “frozen” into a read-only state for performance reasons. Freezables, once frozen, can be safely shared among multiple threads. Most Freezables are graphics primitives such as brushes, pens, geometries, or animation classes.
Globalization is the design and development of applications that perform in multiple locations. WPF provides globalized design features, including automatic layout, satellite assemblies, and localized attributes.
Localization is the translation of application resources into localized versions for the specific cultures that the application supports.
INotifyPropertyChanged in WPF?
INotifyPropertyChanged is an Interface from the namespace System.ComponentModel. It has an event “PropertyChanged” which fires when a property value changes. It is used to notify clients, typically binding clients.
| WPF-Question-Answers-41-50 | WPF-Question-Answers-81-90 | |