WPF

WPF ListView Binding

WPF Listview is a control that is used for display a list of data items. It inherits directly from ListBox. Listview provides an ItemsSource property for binding list of items. Below is the sample program for binding listview items. <Window x:Class=”WpfApplication5.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Title=”MainWindow” Height=”350″ Width=”525″> <Grid> <ListView x:Name=”myListView” /> </Grid> …

WPF ListView Binding Read More
WPF

WPF DataGrid – Common Tasks

Table of Contents Change WPF DataGrid Selected Row Background Color WPF DataGrid Select All Checkbox Change Alternate Row Background Color Change the order (Reorder) of Auto Generated Columns Set Auto Generated Column ReadOnly Change WPF DataGrid Selected Row Background Color To change the background color of selected row of WPF …

WPF DataGrid – Common Tasks Read More
WPF

WPF DataGrid – Filtering

WPF DataGrid provides a way to filter its bounded list. In the filter method, you can choose only those items from the list that you want to show in WPF DataGrid. Rest items will be hidden. DataGrid uses ListCollectionView class for filtering list of items. ListCollectionView ListCollectionView is a special …

WPF DataGrid – Filtering Read More
WPF

WPF Tab Control – Close Button

A very common requirement in TabControl is to show a close button (X) near the end of header of each TabItem. We can use ItemTemplate to customize the header section and show a close button (X) at the end of TabItem header. Close Button Example <Grid> <Grid.Resources> <DataTemplate x:Key=”CustomHeaderTemplate”> <DockPanel …

WPF Tab Control – Close Button Read More
WPF

WPF DataGrid – Custom Columns

In the last tutorial AutoGenerateColumns, I have shown how DataGrid automatically shows different columns based on the data types of data. But by using the Columns property, you can change how columns are generated and of which control. By default, WPF provides 5 different types of custom columns shown below: …

WPF DataGrid – Custom Columns Read More
WPF

WPF DataGrid – Selection Mode

WPF DataGrid provides different properties to select, unselect different rows and columns of grid. Single/Extended The SelectionMode property is used for selecting single/multiple row and columns. This property is an enum which have two values: Single Extended (Default) Single Single allows you to select only one row or column in …

WPF DataGrid – Selection Mode Read More
WPF

WPF DataGrid – Grouping

WPF DataGrid is also used for showing group of items DataGrid use ListCollectionView class for grouping the associated list. DataGrid GroupStyle.ContainerStyle provides a way to display Group Item detail and its associated items. ListCollectionView Class ListCollectionView constructor takes an IList collection and has a GroupDescriptions list property. In the GroupDescriptions …

WPF DataGrid – Grouping Read More