I am using PRISM and MEF frameworks. I have a datagrid which displays some data and underneath it has RowDetailsTemplate which in turn has datagrid. Now if I try to delete a row from the datagrid under the RowDetailsTemplate, UI is not getting refreshed after the delete operation. in other words the row is getting deleted, but a empty space is left and the Rows underneath the present row doesn't move up.
Below is the code snippet.
<Controls1:DataGrid x:Name="dgProposals"
Grid.Row="1" ItemsSource="{Binding Items}" AutoGenerateColumns="False"
BorderThickness="0"
CanUserResizeColumns="False" RowDetailsVisibilityMode="Visible">
<Controls1:DataGrid.Columns>
<Controls1:DataGridTextColumn Binding="{Binding ProposalName}" Width="*"
CanUserSort="False" IsReadOnly="True" CanUserReorder="False" >
</Controls1:DataGridTextColumn>
<Controls1:DataGridTextColumn Binding="{Binding DisplayProposalType}"
Width="*" CanUserSort="False" IsReadOnly="True" CanUserReorder="False" >
</Controls1:DataGridTextColumn>
</Controls1:DataGrid.Columns>
<Controls1:DataGrid.RowDetailsTemplate >
<DataTemplate>
<Controls1:DataGrid x:Name="dgReports" ItemsSource="{Binding ReportList}"
AutoGenerateColumns="False" BorderThickness="0"
CanUserResizeColumns="False" HeadersVisibility="None">
<Controls1:DataGrid.Columns>
<Controls1:DataGridTextColumn Binding="{Binding Name}" Width="*"
CanUserSort="False" IsReadOnly="True" CanUserReorder="False" >
</Controls1:DataGridTextColumn>
<Controls1:DataGridTemplateColumn Width="100" CanUserSort="False"
CanUserReorder="False">
<Controls1:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Button VerticalAlignment="Center" Cursor="Hand"
Command="{Binding DataSource.EditReportNameCommand,
Source={StaticResource DataContextProxy}}"
CommandParameter="{Binding}" Margin="5,0">
</Button>
</StackPanel>
</DataTemplate>
</Controls1:DataGridTemplateColumn.CellTemplate>
</Controls1:DataGridTemplateColumn>
</Controls1:DataGrid.Columns>
</Controls1:DataGrid>
</DataTemplate>
</Controls1:DataGrid.RowDetailsTemplate>
BO Code snippet as follows:
public class ProposalPreview : NotificationObject
{
public string ProposalName { get; set; }
public int PartyId { get; set; }
public string PartyName { get; set; }
public string DisplayProposalType { get; set; }
private ObservableCollection<ArchievedReport> reportList = null;
public ObservableCollection<ArchievedReport> ReportList
{
get { return reportList; }
set { reportList = value; }
}
public ProposalPreview()
{
ProposalName = "";
DisplayProposalType = String.Empty;
ReportList = new ObservableCollection<ArchievedReport>();
}
}
public class ArchievedReport : NotificationObject
{
private string name;
public string Name
{
get { return name; }
set
{
name = value;
RaisePropertyChanged("Name");
}
}
public int ReportId { get; set; }
}
Here Items is ObservableCollection.
Hope I am clear with my description. Kindly let me know if you need additional information. Any help is greatly appreciated. Thanks a lot for your time.
Thanks,
Maddy.