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() public override string ToString()
{ {
var currentBlockGroup = this; if(ParentGroup == null)
{
return string.Empty;
}
var outputString = (Advanced ? "~" : string.Empty) + GroupName; var outputString = (Advanced ? "~" : string.Empty) + GroupName;
// TODO: This is retarded, fix this. var parentOutput = ParentGroup.ToString();
if (currentBlockGroup.ParentGroup != null) if(!string.IsNullOrWhiteSpace(parentOutput))
{ {
while (currentBlockGroup.ParentGroup.ParentGroup != null) outputString = parentOutput + (IsLeafNode ? string.Empty : " - " + outputString);
{
outputString = (currentBlockGroup.ParentGroup.Advanced ? "~" : string.Empty) + currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
currentBlockGroup = currentBlockGroup.ParentGroup;
}
} }
return 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() public void RecalculateCheckState()
{ {
_isShowChecked = DetermineCheckState(true); _isShowChecked = DetermineCheckState(true);

View File

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