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
2090
List inside a cell: How to handle copy&paste
posted

Hello,

I am new to Infragistics and try to make my first steps.

The goal is to have two datagrids, that can use copy&paste and drag&drop unidirectional. (grid A -> grid B). It is a .net 4.5 app with MVVM. I am using xamDataGrid.

Grid A contains all employees - that works fine. Grid B contains a list of jobs (=construction sites of the company) and a week, one column per weekday and the task assignments for each job inside the cell of each job and weekday.

Each job can have mulitple employees per day assigned. I use a listview inside the cell to show the existing assignments. This works as expected.

<igDP:TemplateField Label="Montag" Name="Montag" IsReadOnly="True">
    <igDP:TemplateField.DisplayTemplate>
        <DataTemplate>
            <ListView ItemsSource="{Binding .}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding DisplayText}" TextWrapping="Wrap" ToolTip="{Binding ANMERKUNG}"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </DataTemplate>
    </igDP:TemplateField.DisplayTemplate>
</igDP:TemplateField>

I want to implement following functions:

1. The user selects one or multiple employees in grid A and copies them to the clipboard (in their own class) -> this works

2. The user selects one or multiple cells in grid B and pastes the content of the clipboard

a) I am not able to create an array of SelectedItems that contain only the cells of datagrid B, it always shows the full row.

<igDP:XamDataGrid SelectedDataItemsScope="RecordsOrCells" SelectedDataItems="{Binding SelectedArbeitseinteilungen}"  DataSource="{Binding Baustellen}" Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
ClipboardCopying="CopyArbeitseinteilungen" ClipboardPasting="PasteArbeitseinteilungen" GroupByAreaLocation="None" >

3) The user select 1 or multiple assigned employees inside one cell = one weekday and deletes them (e.g DEL key)

4) One or multiple cells of grid B are selected = means multiple listviews and the user deletes them or pastes a different content

The main problem is (in my understanding) about the relation of the xamDataGrid and its cells that are listviews in this case:

*) Which event is sent to which control (xamDataGrid or ListView)

*) Binding the commands to the right object inside the ViewModel (ItemsSource of Grid B vs. ItemsSource of each single cell)

I hope that I was able to explain the question and look forward to get this thing done.

Thanks

Niko