Tutorials - C#, WPF, ASP.NET MVC, WCF, Entity Framework, AngularJS and MVVM Frameworks - MVVM Light - DotNetPattern.com
WPF provides various templates for customization of controls. WPF ListView ItemTemplate is in one of these. ItemTemplate of ListView is useful when we have to change the visual presentation of bound data objects.
If your WPF ListView control is bound to collection of objects using ItemsSource proeprty and you have not set the ItemTemplate property, then it will call the...
Label control is used for showing the text data in the WPF application. It also provides support for Access Keys.
Label is directly inherit from ContentControl class which provides the Content property to Label control.
In the Content property, you can set the string or host any type of child control.
To build more responsive WPF UI, we have to use multiple threads that can work in the background and update the UI when the work completed.
But background threads can't access the objects created in the STA. Then how can we update the UI when the background threads completed their work?
WPF applications are based on Single Threaded Apartment Model (STA). Ob...
WPF is a successor of Windows Forms. Earlier Windows Forms uses the Windows Graphics Device Interface (GDI+) for rendering any graphics, and drawing text. WPF is a new framework for developing rich Windows smart client applications that uses the DirectX technology behind the scene. WPF is resolution-independent because WPF uses vector graphics for drawing the controls on the sc...
WPF TabControl is used for grouping multiple items that share the same space.
TabControl consists of multiple TabItem controls. One one TabItem is visible at one time.
A TabItem has two areas.
Header is an area for specifying the header of TabItem. All Tab Items headers are always visible.
Content is an area for specifying the child...
TabControl provides a ItemsSource property to bind list of items. ItemsSource takes any collection object which implements the IEnumerable interface.
We bind TabControl with the List<T> or ObservableCollection<T> list classes.
Below is the example TabControl binding with list of MyTabItem class.
TabControl Binding Example
Create a new MyTab...
WPF TabControl provides two templates property for changing the UI for Header and Content area.
ItemTemplate - Get/Set DataTemplate for TabItem Header.
ContentTemplate - Get/Set DateTemplate for TabItem Content.
ItemTemplate is used for changing the DataTemplate of Header section of TabItem. By default, Header DataTemplate call the ToString meth...
TabControl provides two main properties for selection of Items.
SelectedItem property is used for getting and setting the selected object of WPF TabControl. You bind item list into the ItemsSource property of TabControl and set the SelectedItem property to object which you want to selected first.
FlowDirection in WPF TabControl is used for setting the content flow direction of UI elements in header and content area.
FlowDirection is an enum which has only two values:
By default, any TabControl set the FlowDirection property to LeftToRight. In this, all the UI controls in header and cont...
TabStripPlacement is an important propety of TabControl. It is used for setting the Header alignment relative to tab content.
You can set below four values in TabStripPlacement.
I have given all four examples of TabStripPlacement.
Set header to left position like below: