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>
Hello Nikolaus,
I am glad your solution is working now.
Please let us know if you have any more questions.
Sincerely, ZhivkoEntry Level Software Developer
Hello,
I solved this issue by setting the selected item of the first xamDatagrid programmatically on the selection of the second, nested xamDatagrid.
Hi,
I just recognized that the screenshots are not in the posting. Here the second try to post them.
Hello Zhivko,
I have attached two screenshots to illustrate the question:
1. One single row in the main xamDatagrid is selected - you see the bolder, black line
2. On the second screenshot I have select one cell inside (I have highlighted it manually on the screenshot with a red border) the second xamDatagrid. The original selection on the main xamDatagrid stays unchanged.
I would like that the main xamDatagrid changes his selection when I work inside a cell of the second xamDatagrid.
Thanks
I have tested the scenario about XamDataGrid inside XamDataGrid’s cell and I was not able to reproduce any performance issues or better performance, when using ListView instead of XamDataGrid. Please let me know if you observe any issues with this scenario.
Regarding the selection question that you have mentioned in your post, I am not sure what you have in mind with ‘the nested XamDataGrid does not change his current selection’, could you please provide example or more details about this behavior and the functionality you wish to sync?
Looking forward to hearing from you.