Home Forums WPF controls Xceed DataGrid for WPF populate data without binding

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

    Pls Help

    How is possible to populate and retrieve data without binding, manually add and get rows from grid?

    Thanks,
    Zahid
    eWorx intl

    Imported from legacy forums. Posted by zahid (had 1933 views)

    Xceed Support
    Member
    Post count: 5658

    You can use the “unbound” capabilities of the DataGridControl:

    <code>
    <Grid xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <xcdg:DataGridControl x:Name=”UnboundGrid”
    AutoCreateColumns=”False”
    AddingNewDataItem=”AddingDataItem”>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”FirstName”
    Title=”First Name”
    DisplayMemberBinding=”{Binding Path=[0], Mode=TwoWay}”
    CellEditor=”{x:Static xcdg:CellEditor.TextBoxEditor}”/>

    <xcdg:Column FieldName=”LastName”
    Title=”Last Name”
    DisplayMemberBinding=”{Binding Path=[1], Mode=TwoWay}”
    CellEditor=”{x:Static xcdg:CellEditor.TextBoxEditor}”/>

    <xcdg:Column FieldName=”Occupation”
    Title=”Occupation”
    DisplayMemberBinding=”{Binding Path=[2], Mode=TwoWay}”
    CellEditor=”{x:Static xcdg:CellEditor.TextBoxEditor}”/>
    </xcdg:DataGridControl.Columns>

    <xcdg:DataGridControl.Items>
    <x:Array Type=”{x:Type s:String}”>
    <s:String>Pascal</s:String><s:String>Bourque</s:String><s:String>Developer</s:String>
    </x:Array>
    <x:Array Type=”{x:Type s:String}”>
    <s:String>Marc</s:String><s:String>Laroche</s:String><s:String>Developer</s:String>
    </x:Array>
    <x:Array Type=”{x:Type s:String}”>
    <s:String>Michel</s:String><s:String>Fortin</s:String><s:String>Developer</s:String>
    </x:Array>
    <x:Array Type=”{x:Type s:String}”>
    <s:String>Francois</s:String><s:String>Carignan</s:String><s:String>Developer</s:String>
    </x:Array>
    <x:Array Type=”{x:Type s:String}”>
    <s:String>Jenny</s:String><s:String>Beland</s:String><s:String>Technical Writer</s:String>
    </x:Array>
    </xcdg:DataGridControl.Items>

    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.FixedHeaders>
    <DataTemplate>
    <xcdg:InsertionRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>
    </code>

    And then in the code behind:

    <code>
    private void AddingDataItem( object sender, Xceed.Wpf.DataGrid.AddingNewDataItemEventArgs e )
    {
    e.DataItem = new String[] { “”, “”, “”};
    }
    </code>

    Note: This sample will be present in the next version of the documentation.

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

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