There are two types of templates in 1.WPF, and control Templates ControlTemplate and DataTemplate are derived from frameworktemplate.
In total, there are three major template controltemplate,itemspaneltemplate,datatemplate.
A. ControlTemplate The main purpose is to change the appearance of the control. It has two important properties: VisualTree (visual tree) content properties and triggers triggers, which can be used without much consideration for triggers. VisualTree is the rendering of the controls we have drawn. Triggers can make some changes to the elements of our visual tree.
B. Itemspaneltemplate is a special spatial template that is used primarily to indicate how multiple item controls display multiple items of data that it contains. It can also be said to be a panel that specifies the amount of the item's layout. More than one target for multiple content controls. Many are properties of the Panel property or the end of the panel.
C. DataTemplate is primarily used for data presentation. Also known as a template that displays bound data objects.
2. Data binding
There are three types of WPF: Binding,prioritybinding,multibinding, the three base classes of Binding are BindingBase, and BindingBase is inherited from MarkupExtension.
Common use of the binding method is:
The 1-pin is inherited from the FrameworkElement control. SetBinding (DependencyProperty dp,string path), setbinding (DependencyProperty dp,bindingbase binding), where FrameworkElement setbinding only valid for DependencyProperty.
2 another is bindingoperations.setbinding (currentfolder,textblock.textproperty,binding);
The prototype of Bindingoperations.setbinding is
public static Bindingexpressionbase setbinding (DependencyObject target,dependencyproperty dp,bindingbase binding)
3 Clearing the binding:
Bindingoperations.clearbinding (Currentfolder,textblock.textproperty);// Remove the Textblock.textproperty binding on CurrentFolder
Bindingoperations.clearallbindings (CurrentFolder);//delete all bindings on the CurrentFolder.
Assigning a value directly to a dependency property can also remove the binding, but only valid for one-way binding.
4. Extension of logical tree and visual tree visual tree
Logical tree is a subset of the visual tree
WPF handles dependency property inheritance and resource problems through the logical tree, and the visual tree handles event routing, rendering, resource positioning, and more
The logical tree can be thought of as seen in XAML, and the visual tree contains the structure inside the XAML element
5. Property Change Notification ipropertychanged and observablecollection<t>
A. inotifypropertychanged a notification that a property value change is issued to the client.
B. Observablecollection<t> class, which is a built-in implementation of the data collection that implements the INotifyCollectionChanged interface. Represents a Dynamic data collection that provides notification when an item is added, an item is removed, or the entire list is refreshed
6.ResourceDictionary
Provides an implementation of a hash table/Dictionary of WPF resources that contains elements and other elements of a WPF application that implements the sharing of resources for the application
、、、、 problems to be solved
The difference between 7.WPF and WinForm
Routed event Commands (command)
WPF Interview Preparation