Click here to Skip to main content
12,242,431 members (47,989 online)
Click here to Skip to main content

Stats

48.4K views
807 downloads
21 bookmarked
Posted

WPF Introduction: Databinding + Styles + IValueConverter

, 5 Aug 2009 CPOL
A small introduction about Listview Databinding and Styles with introduction to IValueConverter interface
ListViewDataBindingSample
ListViewDataBindingSample
bin
Debug
ListViewDataBindingSample.exe
ListViewDataBindingSample.vshost.exe
Properties
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.

You may also be interested in...

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