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
xamDatagrid with a subgrid in a cell
posted

Hello all,

I am searching for some time now in this forum as well as in other sites (e.g. Stackoverflow) for a solution on following problem: A datagrid is bould to an ObservableCollection<T>. One of the properties of <T> is an ObservableCollection<T1>.

One record represents the workload of a worker per day. it is possible that the worker is assigned to multiple tasks on one day.

In this case I would like to show the record of the day and in one cell the assigned tasks for this day.

This works fine witha template field and a listview.

The problems are:

1. How can I set the size of the columns of the ListView that each of them use 50% of the space inside the TemplateField?

2. How can I make the second column of the ListView (TaskMemo) editable?

Thanks in advance!

Niko

  <igDP:TemplateField Label="Work assignements" Name="WorkAssignments" IsReadOnly="False">
                            <igDP:TemplateField.DisplayTemplate>
                                <DataTemplate>
                                    <ListView ItemsSource="{Binding . ,UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Margin="2,2,0,2" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0" IsHitTestVisible="True">
                                        <ListView.ItemContainerStyle>
                                            <Style TargetType="{x:Type ListViewItem}">
                                                <Setter Property="BorderBrush" Value="LightGray" />
                                                <Setter Property="BorderThickness" Value="0.5" />
                                            </Style>
                                        </ListView.ItemContainerStyle>

                                        <ListView.Resources>
                                            <Style TargetType="GridViewColumnHeader">
                                                <Setter Property="Visibility" Value="Collapsed" />
                                            </Style>

                                            <Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}">
                                                <Setter Property="Focusable" Value="True" />
                                                <Setter Property="IsEnabled" Value="True" />
                                            </Style>

                                        </ListView.Resources>
                                        <ListView.View>
                                            <GridView>
                                                <GridViewColumn DisplayMemberBinding="{Binding TaskName}" />
                                                <GridViewColumn DisplayMemberBinding="{Binding TaskMemo}" />
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                </DataTemplate>
                            </igDP:TemplateField.DisplayTemplate>
                        </igDP:TemplateField>