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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:46:37+00:00 2026-06-04T19:46:37+00:00

I am working on WPF, I am designing a control that contains a datagrid,

  • 0

I am working on WPF, I am designing a control that contains a datagrid, And everything goes well so far.

But something weird just happend: If I show one or more rows in the data grid, the datagrid shows at the end the blank row used to add new rows, as normal, BUT if there is no rows in the data grid, the blank row is not showed either!.

So, I need my datagrid to have always at the end the blank row whether or not data.

I have tried with the properties CanUserAddRows and IsReadOnly but as I said before it only works when there is one or more rows.

Does anybody know how to achieve this?

Thank you in advance.

  • 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-04T19:46:38+00:00Added an answer on June 4, 2026 at 7:46 pm

    Do you mean blank row? Have a look at the answers on wpf datagrid blank row missing

    This basic set-up does display a blank row (even when bound ItemsSource has no data)

    XAML

    <Window x:Class="Demo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        >
    <Grid>
        <DataGrid ItemsSource="{Binding Items}">
            <!--Must define columns if you need columns before bound collection has data-->
            <DataGrid.Columns>
                <DataGridTextColumn Header="Property"  Binding="{Binding Path=MyProperty}">   </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
    </Window>
    

    Code behind

    public class Data
    {
        public Data(string value) { MyProperty = value; }
        public Data() { }  // Must have default constructor
        public String MyProperty { get; set; }
    }
    
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {        
        List<Data> _items = new List<Data>(); 
        public List<Data> Items
        {
            get { return _items; }
        }
    
        public MainWindow()
        {
            InitializeComponent();
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working WPF dialog that uses DataGrid. The DataGrid is set to
I just start study DI (I'm working on WPF/Silverlight but I have a plan
I've got style resources in WPF working so that in my App.xaml I can
I'm working on a WPF app that needs to host some Flash content. The
I'm working on Expression Blend and I'm currently designing a custom control which has
Working in WPF, writing a custom user control. I am trying to change the
Ok been working with WPF for a while but I need some help. I
I am working on wpf PropertyGrid (PG) control and I want the PG to
I'm working with C# and WPF and I would like to study something related
I have been working in WPF web browsers lately but I can't seem to

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.