Jitendra Jadav
Jitendra Jadav

Reputation: 603

How to display Coloumn name in WPF ListBox

I am working WPF I display dataContext into the listbox but I want to display Coloumn name. How I can do it..

Upvotes: 0

Views: 854

Answers (2)

Thomas Levesque
Thomas Levesque

Reputation: 292435

Use a ListView instead, with the view set to a GridView

Upvotes: 0

Simon P Stevens
Simon P Stevens

Reputation: 27499

You need to set the list views view mode to be a grid, and setup columns with headers. Something like this:

<ListView>
    <ListView.View>
        <GridView>
            <GridViewColumn Header="Column name here" DisplayMemberBinding="{Binding Path=DataMemberToBindToColumnGoesHere}"/>

Upvotes: 1

Related Questions