Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WPF Introduction: Databinding + Styles + IValueConverter

, 5 Aug 2009
A small introduction about Listview Databinding and Styles with introduction to IValueConverter interface
ListViewDataBindingSample.zip
ListViewDataBindingSample
ListViewDataBindingSample
bin
Debug
ListViewDataBindingSample.exe
ListViewDataBindingSample.vshost.exe
Properties
Settings.settings
ListViewDataBindingSample.suo
ListViewDataBindingSample.vshost.exe.manifest
<Window x:Class="ListViewDataBindingSample.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ListViewDataBindingSample"
    Title="Databinding Sample" Height="300" Width="615">
    <Window.Resources>
        <local:BooleanConverter x:Key="formatter"/>
    </Window.Resources>
    <Grid  Name="gridElements" VerticalAlignment="Stretch" >
            <ListView  Name="lsvElements" FontSize="11" BorderBrush="DarkGray" BorderThickness="1" 
                    ItemContainerStyle="{DynamicResource ListViewAlternateItemStyle}">
                <ListView.View >
                    <GridView AllowsColumnReorder="True">
                        <GridViewColumn DisplayMemberBinding="{Binding Path=EmpID}" Header="EmpID" Width="75"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=EmpName}" Header="Name" Width="200"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Designation}" Header="Designation" Width="175" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=IsManager, Converter={StaticResource formatter}}" Header="IsManager" Width="75" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Age}" Header="Age" Width="75"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sathishkumar_P
Software Developer (Senior)
India India
Working in a software development company specializing financial products as Senior Developer. Interested in WPF, WCF, C# and C.

| Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 6 Aug 2009
Article Copyright 2009 by Sathishkumar_P
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid