Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1025
Unable to get Add New Row functionality to appear.
posted

What am I doing wrong here? I have been able to get the new row thing to work using a dataset, but this time I am using custom objects. I even changed my one class to inherit from BindingList<> instead of ObservableCollection<> and it still doesn't appear. Here is my code... 

<igDP:XamDataGrid Grid.Row="0"  Margin="10,5,10,5" Background="White" Theme="Aero" x:Name="MetrixRelationDefGrid">
        <igDP:XamDataGrid.FieldLayoutSettings>
          <igDP:FieldLayoutSettings MaxSelectedRecords="1" AddNewRecordLocation="OnTopFixed" AllowAddNew="True" AutoGenerateFields="False">
            <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
              <ItemsPanelTemplate>
                <Grid>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="75" />
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition Width="150" />
                  </Grid.ColumnDefinitions>
                </Grid>
              </ItemsPanelTemplate>
            </igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
          </igDP:FieldLayoutSettings>
        </igDP:XamDataGrid.FieldLayoutSettings>
        <igDP:XamDataGrid.FieldLayouts>
          <igDP:FieldLayout Key="MetrixRelationDef">
            <igDP:FieldLayout.Fields>
              <igDP:Field Name="IsSelected" Label="Selected"/>
              <igDP:Field Name="ParentTableName" Label="Parent Table"/>
              <igDP:Field Name="RelatedTableName" Label="Related Table"/>
            </igDP:FieldLayout.Fields>
          </igDP:FieldLayout>
        </igDP:XamDataGrid.FieldLayouts>
      </igDP:XamDataGrid>

Binding bd = new Binding();
            bd.Source = metrixRelationDefs;
            MetrixRelationDefGrid.SetBinding(XamDataGrid.DataSourceProperty, bd);

 

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace MetrixStudio.CustomObjects
{
    public class MetrixRelationDefs : BindingList<MetrixRelationDef>
    {
    }

    public class MetrixRelationDef
    {
        private string _parentTableName;
        private string _relatedTableName;
        private bool _isSelected;
        private MetrixRelationMaps _relationMaps = new MetrixRelationMaps();
        private MetrixRelationConstraints _relationConstraints = new MetrixRelationConstraints();

        public MetrixRelationDef(string parentTableName, string relatedTableName)
        {
            this.ParentTableName = parentTableName;
            this.RelatedTableName = relatedTableName;
        }

        public MetrixRelationConstraints RelationConstraints
        {
            get { return _relationConstraints; }
            set { _relationConstraints = value; }
        }

        public MetrixRelationMaps RelationMaps
        {
            get { return _relationMaps; }
            set { _relationMaps = value; }
        }

        public bool IsSelected
        {
            get { return _isSelected; }
            set { _isSelected = value; }
        }

        public string ParentTableName
        {
            get { return _parentTableName; }
            set { _parentTableName = value; }
        }

        public string RelatedTableName
        {
            get { return _relatedTableName; }
            set { _relatedTableName = value; }
        }
    }

 

}

 

 

 

Parents Reply Children