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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:03:01+00:00 2026-05-27T03:03:01+00:00

I have a DataGrid bound to a DataTable . I want the DataGrid to

  • 0

I have a DataGrid bound to a DataTable. I want the DataGrid to always have at least ten (empty) rows, also if there are not enough real data-items (the data comes in little by little).
Example

One approach would be to easily add ten empty rows to the DataTable at initialization. But when a real data-item comes in, I can’t easily add the row, I have to find the first empty row to overwrite it, what is not very handy.
So someone knows a smarter/built-in way to achieve this?

  • 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-27T03:03:01+00:00Added an answer on May 27, 2026 at 3:03 am

    It’s gonna be mess, no matter from what side it’s approached. I’d say your best bet (provided that your grid cells content won’t be wrapped) is to use a visual brush (with lines) as your DataGrid’s background.

    UPDATE 1 – XAML
    It’s alwast there, the trick is to use MinHeight, which will produce a vision of blank items thanks to tiled background. If your grid will be populated with the real data the background will expand, rendering more lines.

    One thing I didn’t try is how it’ll handling scrolling.

    Here’s an example:

    <Grid>
        <Grid.Resources>
            <VisualBrush x:Key="StripesBrush" TileMode="Tile" Viewport="0,0,5,20"
                   Viewbox="0,0,10,10" ViewportUnits="Absolute" 
                   ViewboxUnits="Absolute">
                <VisualBrush.Visual>
                    <Line X1="0" X2="10000" Y1="0" Y2="0" Stroke="DarkGray"/>
                </VisualBrush.Visual>
            </VisualBrush>
        </Grid.Resources>
        <DataGrid x:Name="g" AutoGenerateColumns="False" 
                  GridLinesVisibility="None" 
                  MinHeight="100"
                  Height="100"
                  VerticalAlignment="Top"
                  Background="{StaticResource StripesBrush}">
    
            <DataGrid.Columns>
                <DataGridTextColumn Header="A" Width="Auto" Binding="{Binding Item1}">
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="DataGridCell">
                            <Setter Property="Background" Value="Transparent"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="B" Width="Auto" Binding="{Binding Item2}" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
    

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

Sidebar

Related Questions

I have a datagrid getting bound to a dataset, and I want to display
I have a DataGrid , which is bound to a DataTable object. The user
I have a WPF 4.0 DataGrid that is bound to a DataTable using AutoGenerateColumns=True.
I have a DataTable which is going to be bound to a DataGrid. I
I have a datagrid bound to an observable collection of objects. What I want
I have a DataGrid whose ItemsSource is bound to a changing Observable Collection. Inside
I have a DataGrid which is being bound dynamically to a database query. The
I have a problem with a data-bound DataGrid control, in that despite each column
Scenario I have a DevExpress DataGrid which is bound to a DataSet in C#.
I have a windows form with DataBound DataGrid on it. Bound to a list

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.