Fix adding comment block to collapsed section

This commit is contained in:
azakhi 2018-08-19 13:19:14 +03:00
parent 57775a9e22
commit 281c7d85e1

View File

@ -1140,9 +1140,23 @@ namespace Filtration.ViewModels
}
private void OnAddCommentBlockCommand()
{
var selectedBlockAsCommentBlock = SelectedBlockViewModel as IItemFilterCommentBlockViewModel;
if (selectedBlockAsCommentBlock == null || selectedBlockAsCommentBlock.IsExpanded)
{
AddCommentBlock(SelectedBlockViewModel);
}
else
{
var sectionStart = ItemFilterBlockViewModels.IndexOf(selectedBlockAsCommentBlock);
var sectionEnd = sectionStart + 1;
while (sectionEnd < ItemFilterBlockViewModels.Count && ItemFilterBlockViewModels[sectionEnd] as IItemFilterCommentBlockViewModel == null)
{
sectionEnd++;
}
AddCommentBlock(ItemFilterBlockViewModels[sectionEnd - 1]);
}
}
private void OnExpandAllBlocksCommand()
{