AutoSuggest for a WPF Textbox

Auto suggest feature is increasingly popular because of the ease of use. In ASP.Net we can use the Ajax tool kit to get the suggestions easily. But I couldn’t locate one for WPF applications. So I started writing my own. Though the source code is not written completely to cater the rich user friendliness, the code is still usable with or without some small changes.

Suggestions from Database

As I have mentioned bit earlier that the suggestions are expected to be available from a database table. So we are going to get the data into a DataTable. For easier explaining, I usually choose Northwind as the database and this time I have chosen customer as the table for samples.

Note: As it is already explained several times in earlier articles, I am not going to explain again how to get the data and how to read the data from database into a dataset/DataTable. So refer to the DataControls section or GridView section for that m ...

Read more here:   WPF AutoSuggest Textbox 

DataBinding WPF Menu with Dataset

For a complete working application Menu is a best known choice for navigation. Whatever other navigations such as toolbar, tabs etc... are optional and will add value for the application . It is a great control to display hierarchically organized data.  One of the basic thing to be noted is we need to use HierarchicalDataTemplate for loading hierarchical data.

HierarchicalDataTemplate in mapping data

For WPF Menu to understand the hierarchy of the data, we need to define releationships in the HierarchicalDataTemplate. It will work ONLY if the dataset given is the Relational Database with proper relationships added. And give a name that describes the relationships well (for readability). Add a TextBlock for displaying the header table information. In this article we refer categories as the Header. Remember to provide a unique Key for the object also.

ItemsSource in Hierar ...

Read more here:   WPF Menu Databinding 

DataBind WPF ListView

Binding Dataset or DataTable directly to WPF data controls are not as easy as binding WinForms or Asp.Net controls. Still few things are so specific to WPF when binding data. So understanding basics of data binding (atleast basic controls) is necessary before building large applications in WPF.

DataContext as DataSource in WPF ListView

If you are a ASP.Net developer then Datasource is more relevant to you. However DataContext has to be used in place of DataSource. DataTable can be directly used for DataContext  in the code behind. The basic difference is, We don’t need to call Databind explicitly to bind the data(like WinForms).


Don’t get confused with GridView, this is to add ListView items in the listview. Please remember to add ListView.View. Failure to do so will fire an exception “Items collection ...

Read more here:   WPF ListView with GridViewColumn 

WPF Treeview DataBinding with Dataset

I am always fan of TreeView from classic VB days. It is a great control to display hierarchically organized data. But earlier days in VB 6 the TreeView has to be populated by adding nodes through looping. Then in the ASP.Net I had some how improved support by using XML to transform the Dataset to TreeView binding.

HierarchicalDataTemplate in mapping data

TreeView to understand which Node level has to be bound with which level of table in the Dataset we need HierarchicalDataTemplate. It will work if the dataset given is the Relational Database with proper relationships added. And give a name that describes the relationships well. Add a TextBlock for displaying the header table information. In this article we refer categories as the Header. Remember to provide a unique Key for the object.

ItemsSource in HierarchicalDataTemplate

The given relationsh ...

WPF DataGrid Bind with Dataset

Initially when I looked the WPF Toolbox I couldn’t locate the GridView. So I started looking for some equivalents. The closest to what I need was the ListBox. So I had decided to use it for my Media Player.

Need of separate Toolkit from CodePlex

After some point of time I have searched for the WPF DataGrid . I have found the Tool Kit from the CodePlex. Ok now if we need a DataGrid it is not shipped with framework. So we need to download from CodePlex. I have downloaded the binaries. It is a MSI package. So I have installed it. It will not be available in the tool box right after installation, you have to choose the installed component to be listed in the toolbox. 

So to get DataGrid on Toolbox we need select from the list of components. This is available in the “Choose Tool Box Item” dialog box and under the WPF Components section.
&n ...

Read more here:   WPF DataGrid Bind DataSet 

WPF ListBox binding with DataTable

Binding dataset or datatable directly to WPF controls are not exactly like WinForms and Asp.Net. It resembles slightly, but still few things are in WPF style. So understanding basics of Data binding is required before building large applications in WPF.

DataSource equivalent DataContext

DataSource is available in the name of DataContext. So DataTable has to be directly assigned to DataSource. We don’t need to call Databind.

DataTemplate for controls inside the ListItem

Actually ListBox can contain custom DataTemplate if specified. There are other ways to define DataTemplate, but I prefer to put it in Window.Resources. As the controls area are clean from the templates and styles.

DataTemplates allows adding multiple controls. But you can’t directly attach more than one control. So Grid can be used to group the controls.

For displaying ...

Read more here:   WPF Listbox Databinding 

WPF button with Gradient fill and Glow text

When I first started working on Window Presentation Foundation (WPF). I amazed by the ability to format the Win forms applications with predefined styles like web. This helps defining organizing the UI formatting in one place and reusable. If the style of the controls has to be changed in few places, then we can do at one place.

Few points to consider while working on WPF

Basically in WPF most of the attributes of the controls at xaml can be changed with property setters. The same most of the time can be changed at code behind directly also.

Don’t get confused with the WPF Grid with GridView, DataGrid, and DataGridView. WPF grid is a container which is grid based aligning (columns and rows).

Normally for image like formatting DropShadowBitmapEffect can be used. And if you want more effects to be used in single style, then B ...

Spam Bot Trap


Select Theme