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

  • SEARCH
  • Home
  • 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 3306250
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:15:59+00:00 2026-05-17T21:15:59+00:00

I’m not sure what I’m doing wrong here… I have a custom HashTable that

  • 0

I’m not sure what I’m doing wrong here…

I have a custom HashTable that has a method that allows someone to delete a “partNumber” (a value) from the HashTable.

The delete method is as follows:

class COSC202HashTable : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    //....
    private List<int> underlyingList;
    //... 
    public List<int> HashList { get { return underlyingList; } }

    public void Delete(int partNumber)
    {
            string theAlgoritnm = Algorithm;
            if (String.Compare(theAlgoritnm, "Modulo Division") == 0 && String.Compare(Probe, "Linear Collision Resolution") == 0)
            {
                LinearModularDivision(partNumber, false);
            }
            if (String.Compare(theAlgoritnm, "Modulo Division") == 0 && String.Compare(Probe, "Key Offset Collision Resolution") == 0)
            {
                KeyOffsetModularDivision(partNumber, false);
            }
            if (String.Compare(theAlgoritnm, "Pseudorandom") == 0)
            {
                Pseudorandom(partNumber, false);
            }
            if (String.Compare(theAlgoritnm, "Rotation") == 0)
            {
                Rotation(partNumber, false);
            }

            NotifyPropertyChanged("HashList");
    }
   //.......
    private void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
}

I am binding the HashTable’s underlying values to the UI; however the UI is not being updated after a value is deleted. I made sure that there are no problems with spelling etc…

This is the markup I have for my WPF UI:

<Window.Resources>
    <COSC202:COSC202HashTable x:Name="TheHashTable"  x:Key="TheHashTable" PropertyChanged="TheHashTable_PropertyChanged"></COSC202:COSC202HashTable>
</Window.Resources>
<ListView x:Name="HashResults" Height="32" Width="1200" Margin="10"  HorizontalAlignment="Right"
                      DataContext="{Binding Source={StaticResource TheHashTable}}" ItemsSource="{Binding Path=HashList}" HorizontalContentAlignment="Left">
    <ListView.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,2">
            <GradientStop Color="#FF000000" Offset="0"></GradientStop>
            <GradientStop Color="DarkBlue" Offset="1"></GradientStop>
        </LinearGradientBrush>
    </ListView.Background>
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"></StackPanel>
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>

    <ListView.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal" >
                <TextBlock Text="{Binding Path=.}" FontSize="11" Foreground="Azure" VerticalAlignment="Top" ></TextBlock>
                <Label Content="|" VerticalAlignment="Top" FontSize="5"></Label>
            </StackPanel>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

This is the code that I am calling to delete the item in the HashTable upon button click:

  private void DeleteItem_Click(object sender, RoutedEventArgs e)
        {
            Object item = HashResults.SelectedItem;
            COSC202HashTable theHashTable = (COSC202HashTable)this.Resources["TheHashTable"];
            if (theHashTable != null && item != null)
            {
                theHashTable.Delete((int)item);
            }
            HashResults.SelectedIndex = -1;

        }

What am I doing wrong?

Thanks,

-Frinny

  • 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-17T21:15:59+00:00Added an answer on May 17, 2026 at 9:15 pm

    The first place to look for binding errors in the Output window, this quite often will point you in the right direction.

    If you are binding to a custom collection then you may need to implement INotifyCollectionChanged. Or consider changing your data source to ObservableCollection, or in your case you may need ObservableDictionary.

    Also you mentioned spelling errors, there are a couple of ways to ensure that this is not an issue, check out MVVM Foundation‘s base ObservableObject

    Your code is missing a few details, such as your declaration for the StaticResource TheHashTable.

    Edit:
    Raising PropertyChanged against a List class will not notify of changes within that List, if you need the UI to see changes within the list change the list type to ObservableCollection or create a new property:

    public ObservableCollection Hash
    {
      get
      {
        return new ObservableCollection(this.HashList);
      }
    }
    

    and bind to the Hash property.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a JSP page retrieving data and when single or double quotes are
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm looking for suggestions for debugging... If you view this site in Firefox or
I am currently running into a problem where an element is coming back from
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
In order to apply a triggered animation to all ToolTip s in my app,

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.