Fix block group output & expand/collapse all

This commit is contained in:
azakhi 2018-09-06 14:31:06 +03:00
parent 4bed777427
commit 1ee38b4c0e
3 changed files with 18 additions and 10 deletions

View File

@ -57,18 +57,17 @@ namespace Filtration.ObjectModel
public override string ToString()
{
var currentBlockGroup = this;
if(ParentGroup == null)
{
return string.Empty;
}
var outputString = (Advanced ? "~" : string.Empty) + GroupName;
// TODO: This is retarded, fix this.
if (currentBlockGroup.ParentGroup != null)
var parentOutput = ParentGroup.ToString();
if(!string.IsNullOrWhiteSpace(parentOutput))
{
while (currentBlockGroup.ParentGroup.ParentGroup != null)
{
outputString = (currentBlockGroup.ParentGroup.Advanced ? "~" : string.Empty) + currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
currentBlockGroup = currentBlockGroup.ParentGroup;
}
outputString = parentOutput + (IsLeafNode ? string.Empty : " - " + outputString);
}
return outputString;

View File

@ -166,6 +166,15 @@ namespace Filtration.ViewModels
}
}
public void SetIsExpandedForAll(bool isExpanded)
{
IsExpanded = isExpanded;
foreach(var child in VisibleChildGroups)
{
child.SetIsExpandedForAll(isExpanded);
}
}
public void RecalculateCheckState()
{
_isShowChecked = DetermineCheckState(true);

View File

@ -126,7 +126,7 @@ namespace Filtration.ViewModels.ToolPanes
{
foreach (var vm in BlockGroupViewModels)
{
vm.IsExpanded = true;
vm.SetIsExpandedForAll(true);
}
}
@ -134,7 +134,7 @@ namespace Filtration.ViewModels.ToolPanes
{
foreach (var vm in BlockGroupViewModels)
{
vm.IsExpanded = false;
vm.SetIsExpandedForAll(false);
}
}
}