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 8817397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:50:15+00:00 2026-06-14T04:50:15+00:00

I have a simple listview, with a grid control. I have bound an object

  • 0

I have a simple listview, with a grid control. I have bound an object to the grid using observablecollection. inotifyPropertyChanged is implemented on the setter.

The grid has three columns. On a button click I load the grid with some rows of data in two columns. Then the user clicks on another button, and i add some text in the third column in the grid too. Problem is that this new text gets displayed in the grid on only those rows which are not currently on screen. If I scroll down and up, the rest get loaded too as soon as they leave the screen area beyond the scroll.

This might be a starter question, but I have tried various permutations of my code, and have searched and read articles but none helped.

XAML

<Window x:Class="MediaFolderCleanupTool.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="392" Width="582">
    <Grid Height="340" Width="550">
        <Button Content="Search" Height="23" HorizontalAlignment="Left" Margin="12,38,0,0" Name="btnSearch" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        <ListView ItemTemplate="{Binding FileItem}" Height="198" HorizontalAlignment="Left" Margin="14,67,0,0" Name="lstTargetFiles" VerticalAlignment="Top" Width="524" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="" Width="40">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsSelected}" Name="Select" IsThreeState="False"  Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="File"
                      Width="350"
               DisplayMemberBinding="{Binding Path=Name}" />
                    <GridViewColumn Header="Status"
                      Width="100"
               DisplayMemberBinding="{Binding Path=Status}" />
                </GridView>
            </ListView.View>
        </ListView>
        <Button Content="Delete" Height="23" HorizontalAlignment="Left" IsEnabled="False" Margin="13,306,0,0" Name="btnDelete" VerticalAlignment="Top" Width="75" Click="btnDelete_Click_1" />
        <Label Height="28" HorizontalAlignment="Left" Margin="16,271,0,0" Name="lblCount" VerticalAlignment="Top" Width="371" />
    </Grid>
</Window>

On button click on screen, the below gets called

private void DelFiles(ObservableCollection<FileItem> files)
        {

            foreach (FileItem fi in files)
            {
                try
                {
                    fi.Status = "Deleted";
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.InnerException);
                    fi.Status = "Error Deleting";
                }
            }
        }

And here is the FileItem class

class FileItem : INotifyPropertyChanged
    {

        public const string NamePropertyName = "CheckBoxState";

        private bool _checkboxstate = true;

        public string Name { get; set; }
        public string Status { get; set; }
        public bool IsSelected
        {
            get
            {
                return _checkboxstate;
            }
            set
            {
                if (_checkboxstate == value)
                {
                    return;
                }
                _checkboxstate = value;
                OnPropertyChanged(NamePropertyName);
            }


        }
        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
  • 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-06-14T04:50:17+00:00Added an answer on June 14, 2026 at 4:50 am

    Try this:

    class FileItem : INotifyPropertyChanged
        {
    
            public const string NamePropertyName = "CheckBoxState";
    
            private bool _checkboxstate = true;
    
            public string Name { get; set; }
    
            string _status;     
            public string Status 
            { 
                get { return _status; } 
                set { _status = value; OnPropertyChanged("Status"); } 
            }
    
            public bool IsSelected
            {
                get
                {
                    return _checkboxstate;
                }
                set
                {
                    if (_checkboxstate == value)
                    {
                        return;
                    }
                    _checkboxstate = value;
                    OnPropertyChanged(NamePropertyName);
                }
    
    
            }
            public event PropertyChangedEventHandler PropertyChanged;
            protected void OnPropertyChanged(string propertyName)
            {
                if (this.PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple requirement as mentioned below: A ListView or any control displays
I've got a simple ListView which pulls data from an ObservableCollection and I'm using
I have a simple ListView bound to a collection of Calculations. The view calls
I have simple ListView with 3-4 columns. One of the columns have an email
I have a simple WPF ListView with two columns defined. By default when you
I have a simple 3-column ListView. This control is programatically populated with data from
I have simple ListView with few columns and it's populated with data with background
I have a simple ListView, essentially creating a MxN grid. FullRowSelect is off. Essentially
I have a simple ListView that gets populated using an array of SimpleAdapter s.
I have a very simple WPF ListView that I'm using to list blocks of

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.