Home Forums WPF controls Xceed DataGrid for WPF Nothing in datagrid, v1.1.7326

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #23792 |

    When using version 1.0 I have weird problems with the datagrid which I have mentioned before. With v1.1, including the very latest version, I have a datagrid full of… pretty much nothing. I have the datagrid set up to display green lines between each row. This is useful, because although there appears to be nothing in the datagrid, the green lines are present. And when I filter the contents, the number of green lines change to the expected number of lines.

    Is it possible that the data is invisible? white on white? I have basically just swapped dll’s from 1.0 to 1.1 and used a datagridcollectionview instead of a collectionview so I don’t see why this would be the case.

    I have to go very shortly, so I don’t have time now to post code or check for invisible data (which I just thought of as writing the intro to this post) but I thought I’d put this up in case anyone has experienced the same. I know people had trouble with stuff disappearing when changing between tabs, and although this is in a tab control I’m not sure it is the same because there is never anything in there. I’m trying it outside of the tab control but I haven’t got it working yet.

    Imported from legacy forums. Posted by Marie (had 763 views)

    User (Old forums)
    Post count: 23064

    Using snoop I looked at what was in the textblocks in the datagrid and the answer is – nothing. So although it knows how many rows to make, it is not getting the data out of the data source to put into the table.

    This is what I have in xaml:
    <Custom:DataGridControl AutoCreateColumns=”false” x:Name=”datagridAllWizards” Width=”Auto” Height=”Auto” ReadOnly=”True” SelectionMode=”Single” NavigationBehavior=”RowOnly” >

    <Custom:DataGridControl.View >

    <Custom:TableView ShowRowSelectorPane=”False” HorizontalGridLineThickness=”1″ VerticalGridLineThickness=”0″>

    <SolidColorBrush Color=”#FFB9D454″/>
    <Custom:ColumnManagerRow />

    <Custom:Column FieldName=”Player” Title=”Player” />
    <Custom:Column FieldName=”SkillGroup” Title =”Skill Group”/>
    <Custom:Column FieldName=”Skill” Title =”Skill”/>
    <Custom:Column FieldName=”Position” Title=”Position”/>
    <Custom:Column FieldName=”State” Title=”Status”/>

    in code:
    dataviewAllWizards = new DataView();
    dataviewAllWizards.Table = m_catalogue.fullWizardDataSet.Tables[0];
    dgcviewAllWizards = new DataGridCollectionView(dataviewAllWizards);
    dgcviewAllWizards.Filter = new Predicate<object>(this.WizardsFilter);
    datagridAllWizards.ItemsSource = dgcviewAllWizards;

    It’s not connected to any database, just a DataSet that we fill, with works with datagrid v1.0.

    Imported from legacy forums. Posted by Marie (had 516 views)

    User (Old forums)
    Post count: 23064

    If I take out the column definitions, it works, but of course shows all the columns instead of just the ones we want. When the column definitions are in, Visual studio gives this error in the output window:
    System.Windows.Data Error: 35 : BindingExpression path error: ‘State’ property not found on ‘object’ ”DataRow’ (HashCode=31974713)’. BindingExpression:Path=State; DataItem=’DataRow’ (HashCode=31974713); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’)

    Except over and over again for every visible cell.
    Our datatable has columns named Player, SkillGroup, State, etc. The collectionView used to do whatever it does to these ok, so I don’t know what differences there are between collectionView and datagridCollectionView and how it translates between the grid and the table.
    So how do I get the databinding to work so that it can find the data?

    Imported from legacy forums. Posted by Marie (had 402 views)

    Xceed Support
    Post count: 5658


    Just wanted to let you know we are taking a look into this…

    We are going to keep you posted by updating this thread…

    Thanks you for all the additional information… It is very well appreciated.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 293 views)

    Xceed Support
    Post count: 5658

    OK, I nailed down the source of the issue:

    Actually, the problem you are experiencing is “by design”. Let me explain.

    When bound to a DataView using a DataGridCollectionView, the data items exposed are System.Data.DataRow instances instead of DataRowView instances… This is to avoid all the problems linked to the fact that the DataRowView’s instances are “fixed” in position (meaning that if you sort, filter, etc, then the first displayed DataRow will always reuse the same DataRowView instance).

    One of the difference between using DataRowView and System.Data.DataRow is that DataRow does not have property descriptors for the columns (as opposed to DataRowView), therefore, to map to the DataColumn, one must use the indexer from DataRow ( [] )…

    Here is an example of XAML code to workaround this issue.

    <Custom:Column FieldName=”[Player]” Title=”Player” />
    <Custom:Column FieldName=”[SkillGroup]” Title =”Skill Group”/>
    <Custom:Column FieldName=”[Skill]” Title =”Skill”/>
    <Custom:Column FieldName=”[Position]” Title=”Position”/>
    <Custom:Column FieldName=”[State]” Title=”Status”/>

    This particular issue is not linked to the problems encountered by some other users concerning the “empty” data grid control.

    Hope this helped.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 283 views)

    User (Old forums)
    Post count: 23064

    yes! that worked. Great! I don’t know if it is just me being an idiot and not working that out (I’m a bit sick at the moment and some things just aren’t reaching my brain) or if it might be a good idea to have that somewhere in the documentation. At least, I didn’t see it anywhere in there.

    Thanks for your help.

    Imported from legacy forums. Posted by Marie (had 4989 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.