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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:06:52+00:00 2026-05-31T16:06:52+00:00

xaml side: <DataGrid Name=MyGrid ItemsSource={Binding} /> I tried also with: <DataGrid Name=MyGrid ItemsSource={Binding MyObj}

  • 0

xaml side:

<DataGrid Name="MyGrid" ItemsSource="{Binding}" />

I tried also with:

<DataGrid Name="MyGrid" ItemsSource="{Binding MyObj}" />

The code behind:

MyGrid.ItemsSource = new[] {
    new MyObj{A = "aaa", B = "sss"},
    new CompteurDate{A = "bbb", B = "eee"}
};

The result shows the correct number of items in the grid, but the rows are blank.
Im sure it’s deadly easy but Im stuck :-/
Any idea?

Thanks in advance,
Eric

  • 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-31T16:06:53+00:00Added an answer on May 31, 2026 at 4:06 pm

    Sorry Rachel, I didn’t post properly:

    MyGrid.ItemsSource = new[] {
        new MyObj{A = "aaa", B = "sss"},
        new CompteurDate{A = "bbb", B = "eee"}
    };
    

    Should have been:

    MyGrid.ItemsSource = new[] {
        new MyObj{A = "aaa", B = "sss"},
        new MyObj{A = "bbb", B = "eee"}
    };
    

    Sorry about that.. (I a

    Anyway, I found my way! The object kind I was using was in cause. Whit this it didn’t work:

    public class MyObject
    {
        public string A;
        public string B;
    }
    

    And like that it did:

    public class MyObject
    {
        public string A { get; set; }
        public string B { get; set; }
    }
    

    So I step out of my hello world code, back to my real life implemantation, and…. it didn’t work, damn.
    I had an IEnumerable instead of an array. Long story short, adding a “ToArray()” at the end made it, but I don’t understand why. Ok, my enumerable was subject to late execution, but the datagrid reading its ItemsSource shoud have trigged this execution, isn’t it?

    So, problem solved but if someone have some rational light to put on this magic…

    Thanks!

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

Sidebar

Related Questions

Does the XAML file and its .cs code behind run on server-side or client-side?
Consider the following XAML: <ComboBox Name=CompanyComboBox HorizontalAlignment=Stretch ItemsSource={Binding Path=GlobalData.Companies} SelectedValuePath=Id SelectedValue={Binding Customer.CompanyId, ValidatesOnDataErrors=True} DisplayMemberPath=Name
I have the following XAML: <StackPanel> <StackPanel Orientation=Horizontal> <Border Name=B1 Width=Auto> <DataGrid /> </Border>
The XAML code: <Canvas> <Button x:Name=btnCanvasButton Content=Canvas Button Canvas.Left=50 /> <Button x:Name=btnCanvasButton2 Content=Canvas Button
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
I know how to change the tooltip in the xaml side of things, but
I have a requirement to take client side XAML (from Silverlight) and create a
XAML: <ToolBarTray Name=tlbTray ButtonBase.Click=tlbTray_Click> <ToolBar Name=tlbFile> <Button Name=btnOpen><Image Source=images\folder.png Stretch=None /></Button> <Button Name=btnSave><Image Source=images\disk.png
Since XAML gets compiled, there should be no difference in execution of code like

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.