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
350
XamlDataGrid Add New Button is Disabled.(Someone Please reply)
posted

Hi,

I want to provider AddNew,Delete and update option in the xamdataGrid.I am binding to BindingList<T> collection.It shows the AddNew Button but it is disabled.I unable to add a new record.Below is the source code.


XAML Code.

<igDP:XamDataGrid HorizontalAlignment="Stretch" UpdateMode="OnCellChangeOrLostFocus" VerticalAlignment="Stretch" DataSource="{Binding Path=BusinessObjectCollection}" Margin="0,0,0,0" Grid.Row="0" GroupByAreaLocation="None">

<igDP:XamDataGrid.FieldSettings>

<igDP:FieldSettings AllowEdit="True"/>

</igDP:XamDataGrid.FieldSettings>

<igDP:XamDataGrid.FieldLayoutSettings>

<igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" AllowDelete="True" SelectionTypeCell="Single" SelectionTypeField="None" SelectionTypeRecord="Single"/>

</igDP:XamDataGrid.FieldLayoutSettings>

<igDP:XamDataGrid.FieldLayouts>

<igDP:FieldLayout>

<igDP:FieldLayout.Fields>

<igDP:Field Name="FirstName" Label="First Name">

<igDP:Field.Settings>

<igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}"></igDP:FieldSettings>

</igDP:Field.Settings>

</igDP:Field>

<igDP:Field Name="LastName" Label="Last Name"/>

<igDP:Field Name="Address"/>

<igDP:Field Name="PhoneNumber"/>

</igDP:FieldLayout.Fields>

</igDP:FieldLayout>

</igDP:XamDataGrid.FieldLayouts>

</igDP:XamDataGrid>

 C# Code:

public override BindingListCollection<BaseDTO> GetBusinessObjects()

{

BindingListCollection<BaseDTO> SalesPersons = new BindingListCollection<BaseDTO>();

SalesRegion Region = Database.GetSalesRegion(2);

foreach (SalesPerson person in Region.SalesPersons)

{

SalesPersons.Add(person);

}

return SalesPersons;

}

Thanks in Advance