3 Replies - 9898 Views - Last Post: 14 December 2011 - 08:41 PM

#1 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

[problem] dataGrid cell contents not showing

Posted 21 November 2011 - 04:52 AM

Good day to you all,

I have a problem with my dataGrid(jibGrid) control. I am working on a master/details scenario, and I am reading the selectedRow values from the dataGrid in order to fill my details textBoxes.

That works great, except sometimes(not always, but most of the times) if the grid is limited to a certain maxWidth value, then a horizontalScrollbar appears, and when I read the values from the grid I am only able to read those which are visible. If I as a user drag the horizontalScrollBar to the end, then I am able to read all of the values.

I already checked if the visibility is on for the dataGridColumns and it is for all of them, but the content I think is read dynamically.

this is the code I use to iterate through the columns to get the value of the cell.

TextBlock y = grid.SelectedItem as TextBlock;
            if (grid.SelectedItem != null)
            { //x=0;
                foreach (DataGridColumn kol in grid.Columns)
                {
                    kol.Visibility = Visibility.Visible;
                    
                    list.Add(((TextBlock)kol.GetCellContent(grid.SelectedItem)).Text);
                    //MessageBox.Show(kol.Visibility.ToString());
                    //x++;
                }
            }


I hope a good soul will be found to help me out :)

Is This A Good Question/Topic? 0
  • +

Replies To: [problem] dataGrid cell contents not showing

#2 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: [problem] dataGrid cell contents not showing

Posted 09 December 2011 - 11:13 AM

What does your XAML look like for this grid. Are you binding to an observable collection to populate etc? Not sure I understand what exactly you are asking.
Was This Post Helpful? 0
  • +
  • -

#3 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: [problem] dataGrid cell contents not showing

Posted 12 December 2011 - 01:18 AM

View PostMKunstman, on 09 December 2011 - 08:13 PM, said:

What does your XAML look like for this grid. Are you binding to an observable collection to populate etc? Not sure I understand what exactly you are asking.


Thanks for the reply.

When I as user try to select and edit the data from the grid, in my master/detail scenario, what happens is, some textBoxes do not receive value because not all the grid columns are visible(because there are many columns, and a horizontal scrollbar appears). From those columns that are visible, their values go to the textBoxes in my details canvas. And when I drag the horizontal scrollbar to the right and reveal new columns, those values of the revealed columns will appear in my details' textboxes.

I use a jibgrid it is just a grid with filter options. In that respect the only difference is instead of using the property ItemSource of the grid, I use the property FilteredItemSource.

The grid is not using the binding thing. The way I fill the grid is programatically. Here is an example of a code that I use for populating the grid:
grid.FilteredItemsSource = DynamicDataBuilder.GetDataList(e.Result);

the DynamicDataBuilder.GetDataList() returns IEnumerable.

I hope I made things more clear. :)

This post has been edited by PennyBoki: 12 December 2011 - 01:20 AM

Was This Post Helpful? 0
  • +
  • -

#4 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: [problem] dataGrid cell contents not showing

Posted 14 December 2011 - 08:41 PM

I am not sure why you are going the route that you are with populating the grid. Using an ObservableCollection http://msdn.microsof...y/ms668604.aspx allows you to bind the grid to the object and notify when any property of that object has changed. Thus you can in reality edit the data on the fly so to speak. It might be a little extra code depending on your structure. I am a big fan of the MVVM architecture so thus why I ask.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1