Home Forums WPF controls Xceed DataGrid for WPF OverflowException

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25337 |

    I’m new to the DataGridControl and WPF in general. I’m currently working to prototype part of our existing application in WPF and have been using your control. The problem that I am running into is when the grid is put into edit mode, an overflowException occurs (InsertionRow or the body). Here is what I have:

    ———————————————————————————————————
    <qc:BaseView x:Class=”Companion.TeamUserControl”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    xmlns:DataGrid=”clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid”
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    xmlns:System=”clr-namespace:System;assembly=mscorlib”
    xmlns:qc=”clr-namespace:Companion”
    >
    <Grid>
    <xcdg:DataGridControl x:Name=”_grid”>
    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow />
    </DataTemplate>
    <DataTemplate>
    <xcdg:InsertionRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>
    </qc:BaseView>
    ———————————————————————————————————
    public TeamUserControl()
    {
    InitializeComponent();

    _teamMembers = new TeamMemberCollection();
    DataGridCollectionView view = new DataGridCollectionView(_teamMembers);

    view.ItemProperties.Clear();

    view.ItemProperties.Add(new DataGridItemProperty(“Name”, “Name”, typeof(String)));
    view.ItemProperties.Add(new DataGridItemProperty(“JobTitle”, “JobTitle”, typeof(String)));
    view.ItemProperties.Add(new DataGridItemProperty(“Department”, “Department”, typeof(String)));

    _grid.ItemsSource = view;
    }

    ———————————————————————————————————

    public class TeamMember
    {
    private String _name;
    private String _jobTitle;
    private String _department;

    public String Name
    {
    get { return _name; }
    set { _name = value; }
    }

    public String JobTitle
    {
    get { return _jobTitle; }
    set { _jobTitle = value; }
    }

    public String Department
    {
    get { return _department; }
    set { _department = value; }
    }

    public TeamMember()
    {
    }

    public TeamMember(String name, String jobTitle, String department)
    {
    Name = name;
    JobTitle = jobTitle;
    Department = department;
    }
    }

    public class TeamMemberCollection : CollectionBase, IBindingList
    {
    public void Add(TeamMember teamMember)
    {
    List.Add(teamMember);
    }

    protected override void OnValidate(object value)
    {
    base.OnValidate(value);

    if (!(value is TeamMember))
    throw new ArgumentException(“Invalid type.”);
    }

    public object AddNew()
    {
    TeamMember teamMember = new TeamMember();
    Add(teamMember);

    return teamMember;
    }

    public bool AllowNew
    {
    get { return true; }
    }

    public bool AllowRemove
    {
    get { return true; }
    }

    public bool AllowEdit
    {
    get { return true; }
    }

    public bool SupportsSorting
    {
    get { return false; }
    }

    public bool SupportsSearching
    {
    get { return false; }
    }

    public bool SupportsChangeNotification
    {
    get { return true; }
    }

    public void AddIndex(PropertyDescriptor property)
    {
    throw new NotSupportedException();
    }

    public void ApplySort(PropertyDescriptor property, ListSortDirection direction)
    {
    throw new NotSupportedException();
    }

    public int Find(PropertyDescriptor property, object key)
    {
    throw new NotSupportedException();
    }

    public void RemoveSort()
    {
    throw new NotSupportedException();
    }

    public void RemoveIndex(PropertyDescriptor property)
    {
    throw new NotSupportedException();
    }

    public PropertyDescriptor SortProperty
    {
    get { throw new NotSupportedException(); }
    }

    public bool IsSorted
    {
    get { throw new NotSupportedException(); }
    }

    public ListSortDirection SortDirection
    {
    get { throw new NotSupportedException(); }
    }

    protected virtual void OnListChanged(ListChangedEventArgs e)
    {
    if (ListChanged != null)
    ListChanged(this, e);
    }

    public event ListChangedEventHandler ListChanged;
    }
    SD

    Imported from legacy forums. Posted by Sean (had 1787 views)

    User (Old forums)
    Member
    Post count: 23064

    Can you post the stacktrace?

    Imported from legacy forums. Posted by nat (had 3097 views)

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