Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:56:24+00:00 2026-05-27T09:56:24+00:00

I have a hash table and I want to bind it to a ListView

  • 0

I have a hash table and I want to bind it to a ListView in wpf in the code or code behind.

My ListView is

  <ListView Canvas.Left="1045" Canvas.Top="634" Height="244" Name="lvContact" Width="536" >
            <ListView.View>
                <GridView x:Name="gvContacts">
                    <GridView.Columns>
                        <GridViewColumn Width="200" x:Name="ContactName" DisplayMemberBinding="{Binding Path=Username}"></GridViewColumn>
                    </GridView.Columns>
                </GridView>

            </ListView.View>

        </ListView>

On the code beind I have no idea how to bind it, but before I was using this in a Windows Forms app

        //foreach (DictionaryEntry de in contactList)
        //{
        //    ListViewItem contactItem = new ListViewItem(de.Key.ToString());

        //    if (de.Value.ToString() == "NLN")
        //    {
        //        contactItem.ForeColor = System.Drawing.Color.Green;
        //    }
        //    else
        //    {
        //        contactItem.ForeColor = System.Drawing.Color.Gray;
        //    }


        //    lvContact.Items.Add(contactItem);

    //}

But now it doesnt work properly please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:56:24+00:00Added an answer on May 27, 2026 at 9:56 am

    You’re just missing the standard binding. Here’s the XAML for a ListBox:

            <ListBox DockPanel.Dock="Bottom" ItemsSource="{Binding Applications}" DisplayMemberPath="Name"
                     SelectedItem="{Binding SelectedApplication}" Height="auto"/>
    

    And here’s the XAML for a DataGrid:

            <DataGrid Height="280" AutoGenerateColumns="False" IsReadOnly="True" HeadersVisibility="Column"
                  ItemsSource="{Binding SelectedApplication.Tasks}"
                  SelectedItem="{Binding SelectedTask}">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=Sequence}" Header="Order" Width="50" />
                    <DataGridTextColumn Binding="{Binding Path=Description}" Header="Description" Width="*"/>
                    <DataGridTextColumn Binding="{Binding Path=TaskType}" Header="Type" Width="120"/>
                    <DataGridTextColumn Binding="{Binding Path=FailureCausesAllStop}" Header="Stop" Width="50"/>
                </DataGrid.Columns>
            </DataGrid>
    

    In your view model (or code-behind), you need to have your source data:

        public Collection<Application> Applications
        {
            get { return this._applications; }
    
            private set
            {
                this._applications = value;
                this.NotifyPropertyChanged(() => this.Applications);
            }
        }
    

    And:

        public Application SelectedApplication
        {
            get { return this._selectedApplication; }
    
            set
            {
                this._selectedApplication = value;
                this.NotifyPropertyChanged(() => this.SelectedApplication);
            }
        }
    

    Just google or read about binding and you’ll be all set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a hash table that I want to store to disk. The list
I have a hash table where the keys are rather complex lists, with sublists
I have a hash table with the following contents: my %hash = ( 'a'
What I can think of is: Algo: Have a hash table which will store
So if I have to choose between a hash table or a prefix tree
Lets say that I have only DHT (distributed hash table) implemented (in Python), and
I have a hash table generated which I am then trying to add to
Does the DOM have a hash-table of elements whose keys are the elements' ids?
I have a Javascript hash table, like so: var things = [ ]; things[hello]
I have a hash map table as below, HashMap<String, String> backUpCurency_values = new HashMap<String,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.