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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:13:35+00:00 2026-06-08T22:13:35+00:00

I have a data grid in my WPF application window, which I have to

  • 0

I have a data grid in my WPF application window, which I have to bind to an observable collection. I have to give the option to the user to be able to the edit, remove, add and edit items in this data grid.

I did the binding of the datagrid in the following, but wanted to ask how do I allow the user to add, edit/update, delete the items from the data grid readily.

Here’s my current code:

.xaml

<DataGrid x:Name="dgrQuestions" AutoGenerateColumns="False" Height="272" HorizontalAlignment="Left" Margin="42,73,0,0" VerticalAlignment="Top" Width="669" ItemsSource="{Binding QuestionsList}">
      <DataGrid.Columns>                
            <DataGridTextColumn Header="FirstQues" Binding="{Binding Question}"/>
            <DataGridTextColumn Header="SecondQues" Binding="{Binding Answer}"/>
            <DataGridTextColumn Header="ThirdQues" Binding="{Binding Hint}"/>
      </DataGrid.Columns>
</DataGrid>

.xaml.cs code

using Quest; //class having the format of the question

public class Master
{

    private ObservableCollection<Quest> questList;
        public event PropertyChangedEventHandler PropertyChanged;        

        public ObservableCollection<Quest> QuestionList
        {
            get { return questList; }
            set 
            {             
                questList = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("QuestionsList"));
            }
        }

    //Add, Edit, Remove, Reset methods required
}

.cs code (only properties mentioned here) for the class for which objects are created:

public string Question
        {
            get { return _question; }
            set{ _question = value; OnPropertyChanged("Question"); }
        }

        public string Answer
        {   get { return _answer; }
            set {_answer = value; OnPropertyChanged("Answer"); }
        }

        public string Hint
        {
            get { return _hint; }
            set { _hint = value; OnPropertyChanged("Hint"); }
        }
  • 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-08T22:13:38+00:00Added an answer on June 8, 2026 at 10:13 pm

    To add/delete, make sure the CanUserAddRows and CanUserDeleteRows properties are set to true. The user should then be able to add rows by entering into the blank row at the bottom and delete rows by selecting them and pressing Delete on the keyboard.

    To edit rows, the IsReadOnly property must be false (which it is by default).

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

Sidebar

Related Questions

I am using a WPF c# application. I have a user control which contains
I created a wpf application which have a single window which is getting started
I'm planning a WPF application which will be able to create dynamic data entry
I have a .Net 4.0 WPF application using a data grid. Currently after sorting
I have got a WPF Application, which contains a Window, inside it there is
I have a DataGrid in a WPF application which has for its ItemsSource a
I am a beginner to WPF . I have a data grid for showing
I have a DataGrid in WPF bound to an observable collection. In my UI
In my WPF application im trying to visualize some temperature data. I have a
In my application i have a WPF Window that has a DataGrid in it.

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.