Merge pull request #75 from azakhi/feature/40-add-enable-disable-to-group-browser
Feature/40 add enable disable to group browser
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.ObjectModel;
|
||||
@@ -8,9 +9,12 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
internal class ItemFilterBlockGroupViewModel : ViewModelBase
|
||||
{
|
||||
private bool? _isChecked;
|
||||
private bool _reentrancyCheck;
|
||||
private bool _postMapComplete;
|
||||
private bool? _isShowChecked;
|
||||
private bool? _isEnableChecked;
|
||||
private bool _showReentrancyCheck;
|
||||
private bool _enableReentrancyCheck;
|
||||
private bool _showPostMapComplete;
|
||||
private bool _enablePostMapComplete;
|
||||
private bool _isExpanded;
|
||||
|
||||
public ItemFilterBlockGroupViewModel()
|
||||
@@ -24,7 +28,10 @@ namespace Filtration.ViewModels
|
||||
ParentGroup = parent;
|
||||
Advanced = itemFilterBlockGroup.Advanced;
|
||||
SourceBlockGroup = itemFilterBlockGroup;
|
||||
IsChecked = itemFilterBlockGroup.IsChecked;
|
||||
SourceBlockGroup.ClearStatusChangeSubscribers();
|
||||
SourceBlockGroup.BlockGroupStatusChanged += OnSourceBlockGroupStatusChanged;
|
||||
IsShowChecked = itemFilterBlockGroup.IsShowChecked;
|
||||
IsEnableChecked = itemFilterBlockGroup.IsEnableChecked;
|
||||
|
||||
ChildGroups = new ObservableCollection<ItemFilterBlockGroupViewModel>();
|
||||
foreach (var childGroup in itemFilterBlockGroup.ChildGroups.Where(c => showAdvanced || !c.Advanced))
|
||||
@@ -32,6 +39,12 @@ namespace Filtration.ViewModels
|
||||
ChildGroups.Add(new ItemFilterBlockGroupViewModel(childGroup, showAdvanced, this));
|
||||
}
|
||||
|
||||
VisibleChildGroups = new ObservableCollection<ItemFilterBlockGroupViewModel>();
|
||||
foreach (var childGroup in ChildGroups.Where(item => !item.IsHidden))
|
||||
{
|
||||
VisibleChildGroups.Add(childGroup);
|
||||
}
|
||||
|
||||
if (ChildGroups.Any())
|
||||
{
|
||||
SetIsCheckedBasedOnChildGroups();
|
||||
@@ -40,54 +53,105 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void SetIsCheckedBasedOnChildGroups()
|
||||
{
|
||||
if (ChildGroups.All(g => g.IsChecked == true))
|
||||
if (ChildGroups.All(g => g.IsShowChecked == true))
|
||||
{
|
||||
IsChecked = true;
|
||||
IsShowChecked = true;
|
||||
}
|
||||
else if (ChildGroups.Any(g => g.IsChecked == true || g.IsChecked == null))
|
||||
else if (ChildGroups.Any(g => g.IsShowChecked == true || g.IsShowChecked == null))
|
||||
{
|
||||
IsChecked = null;
|
||||
IsShowChecked = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsChecked = false;
|
||||
IsShowChecked = false;
|
||||
}
|
||||
|
||||
if (ChildGroups.All(g => g.IsEnableChecked == true))
|
||||
{
|
||||
IsEnableChecked = true;
|
||||
}
|
||||
else if (ChildGroups.Any(g => g.IsEnableChecked == true || g.IsEnableChecked == null))
|
||||
{
|
||||
IsEnableChecked = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsEnableChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public string GroupName { get; internal set; }
|
||||
public ItemFilterBlockGroupViewModel ParentGroup { get; internal set; }
|
||||
public ObservableCollection<ItemFilterBlockGroupViewModel> ChildGroups { get; internal set; }
|
||||
public ObservableCollection<ItemFilterBlockGroupViewModel> VisibleChildGroups { get; internal set; }
|
||||
public bool Advanced { get; internal set; }
|
||||
public bool IsHidden
|
||||
{
|
||||
get => SourceBlockGroup.IsLeafNode;
|
||||
}
|
||||
public ItemFilterBlockGroup SourceBlockGroup { get; internal set; }
|
||||
|
||||
public bool? IsChecked
|
||||
public bool? IsShowChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isChecked;
|
||||
return _isShowChecked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!_postMapComplete)
|
||||
if (!_showPostMapComplete)
|
||||
{
|
||||
_isChecked = value;
|
||||
_postMapComplete = true;
|
||||
_isShowChecked = value;
|
||||
_showPostMapComplete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isChecked != value)
|
||||
if (_isShowChecked != value)
|
||||
{
|
||||
|
||||
if (_reentrancyCheck)
|
||||
if (_showReentrancyCheck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_reentrancyCheck = true;
|
||||
_isChecked = value;
|
||||
UpdateCheckState();
|
||||
_showReentrancyCheck = true;
|
||||
_isShowChecked = value;
|
||||
UpdateCheckState(true);
|
||||
RaisePropertyChanged();
|
||||
SourceBlockGroup.IsChecked = value ?? false;
|
||||
_reentrancyCheck = false;
|
||||
SourceBlockGroup.IsShowChecked = value;
|
||||
_showReentrancyCheck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool? IsEnableChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isEnableChecked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!_enablePostMapComplete)
|
||||
{
|
||||
_isEnableChecked = value;
|
||||
_enablePostMapComplete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isEnableChecked != value)
|
||||
{
|
||||
|
||||
if (_enableReentrancyCheck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_enableReentrancyCheck = true;
|
||||
_isEnableChecked = value;
|
||||
UpdateCheckState(false);
|
||||
RaisePropertyChanged();
|
||||
SourceBlockGroup.IsEnableChecked = value;
|
||||
_enableReentrancyCheck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,39 +167,74 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCheckState()
|
||||
public void SetIsExpandedForAll(bool isExpanded)
|
||||
{
|
||||
IsExpanded = isExpanded;
|
||||
foreach(var child in VisibleChildGroups)
|
||||
{
|
||||
child.SetIsExpandedForAll(isExpanded);
|
||||
}
|
||||
}
|
||||
|
||||
public void RecalculateCheckState()
|
||||
{
|
||||
_isShowChecked = DetermineCheckState(true);
|
||||
_isEnableChecked = DetermineCheckState(false);
|
||||
RaisePropertyChanged(nameof(IsShowChecked));
|
||||
RaisePropertyChanged(nameof(IsEnableChecked));
|
||||
}
|
||||
|
||||
private void UpdateCheckState(bool isShowCheck)
|
||||
{
|
||||
// update all children:
|
||||
if (ChildGroups.Count != 0)
|
||||
{
|
||||
UpdateChildrenCheckState();
|
||||
UpdateChildrenCheckState(isShowCheck);
|
||||
}
|
||||
|
||||
// update parent item
|
||||
// inform parent about the change
|
||||
if (ParentGroup != null)
|
||||
{
|
||||
var parentIsChecked = ParentGroup.DetermineCheckState();
|
||||
ParentGroup.IsChecked = parentIsChecked;
|
||||
var parentValue = isShowCheck ? ParentGroup.IsShowChecked : ParentGroup.IsEnableChecked;
|
||||
var ownValue = isShowCheck ? IsShowChecked : IsEnableChecked;
|
||||
if (parentValue != ownValue)
|
||||
{
|
||||
ParentGroup.RecalculateCheckState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateChildrenCheckState()
|
||||
private void UpdateChildrenCheckState(bool isShowCheck)
|
||||
{
|
||||
foreach (var childGroup in ChildGroups.Where(c => IsChecked != null))
|
||||
// Update children only when state is not null which means update is either from children
|
||||
// (all children must have same value to be not null) or from user
|
||||
if (isShowCheck && IsShowChecked != null)
|
||||
{
|
||||
childGroup.IsChecked = IsChecked;
|
||||
foreach (var childGroup in ChildGroups.Where(c => IsShowChecked != null))
|
||||
{
|
||||
childGroup.IsShowChecked = IsShowChecked;
|
||||
}
|
||||
}
|
||||
else if (IsEnableChecked != null)
|
||||
{
|
||||
foreach (var childGroup in ChildGroups.Where(c => IsEnableChecked != null))
|
||||
{
|
||||
childGroup.IsEnableChecked = IsEnableChecked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool? DetermineCheckState()
|
||||
private bool? DetermineCheckState(bool isShowCheck)
|
||||
{
|
||||
var allChildrenChecked = ChildGroups.Count(x => x.IsChecked == true) == ChildGroups.Count;
|
||||
var allChildrenChecked = (isShowCheck ? ChildGroups.Count(x => x.IsShowChecked == true) :
|
||||
ChildGroups.Count(x => x.IsEnableChecked == true)) == ChildGroups.Count;
|
||||
if (allChildrenChecked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var allChildrenUnchecked = ChildGroups.Count(x => x.IsChecked == false) == ChildGroups.Count;
|
||||
var allChildrenUnchecked = (isShowCheck ? ChildGroups.Count(x => x.IsShowChecked == false) :
|
||||
ChildGroups.Count(x => x.IsEnableChecked == false)) == ChildGroups.Count;
|
||||
if (allChildrenUnchecked)
|
||||
{
|
||||
return false;
|
||||
@@ -143,5 +242,19 @@ namespace Filtration.ViewModels
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnSourceBlockGroupStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
// We assume that source block group status is only changed by either view model
|
||||
// or related ItemFilterBlock if leaf node
|
||||
if(SourceBlockGroup.IsShowChecked != IsShowChecked)
|
||||
{
|
||||
IsShowChecked = SourceBlockGroup.IsShowChecked;
|
||||
}
|
||||
if (SourceBlockGroup.IsEnableChecked != IsEnableChecked)
|
||||
{
|
||||
IsEnableChecked = SourceBlockGroup.IsEnableChecked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using Filtration.ObjectModel.Enums;
|
||||
using Filtration.Services;
|
||||
using Filtration.Views;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Microsoft.Win32;
|
||||
using Xceed.Wpf.Toolkit;
|
||||
|
||||
@@ -52,6 +53,8 @@ namespace Filtration.ViewModels
|
||||
PlayPositionalSoundCommand = new RelayCommand(OnPlayPositionalSoundCommand, () => HasPositionalSound);
|
||||
PlayCustomSoundCommand = new RelayCommand(OnPlayCustomSoundCommand, () => HasCustomSound);
|
||||
CustomSoundFileDialogCommand = new RelayCommand(OnCustomSoundFileDialog);
|
||||
AddBlockGroupCommand = new RelayCommand(OnAddBlockGroupCommand);
|
||||
DeleteBlockGroupCommand = new RelayCommand(OnDeleteBlockGroupCommand, () => BlockGroups.Count > 0);
|
||||
}
|
||||
|
||||
public override void Initialise(IItemFilterBlockBase itemFilterBlockBase, IItemFilterScriptViewModel parentScriptViewModel)
|
||||
@@ -62,9 +65,12 @@ namespace Filtration.ViewModels
|
||||
throw new ArgumentNullException(nameof(itemFilterBlock));
|
||||
}
|
||||
|
||||
BlockGroups = new ObservableCollection<ItemFilterBlockGroup>();
|
||||
|
||||
_parentScriptViewModel = parentScriptViewModel;
|
||||
|
||||
Block = itemFilterBlock;
|
||||
Block.EnabledStatusChanged += OnBlockEnabledStatusChanged;
|
||||
|
||||
itemFilterBlock.BlockItems.CollectionChanged += OnBlockItemsCollectionChanged;
|
||||
|
||||
@@ -73,6 +79,8 @@ namespace Filtration.ViewModels
|
||||
blockItem.PropertyChanged += OnBlockItemChanged;
|
||||
}
|
||||
base.Initialise(itemFilterBlock, parentScriptViewModel);
|
||||
|
||||
UpdateBlockGroups();
|
||||
}
|
||||
|
||||
public RelayCommand CopyBlockStyleCommand { get; }
|
||||
@@ -86,9 +94,16 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand SwitchBlockItemsViewCommand { get; }
|
||||
public RelayCommand CustomSoundFileDialogCommand { get; }
|
||||
public RelayCommand PlayCustomSoundCommand { get; }
|
||||
public RelayCommand AddBlockGroupCommand { get; }
|
||||
public RelayCommand DeleteBlockGroupCommand { get; }
|
||||
|
||||
public IItemFilterBlock Block { get; private set; }
|
||||
|
||||
public ObservableCollection<ItemFilterBlockGroup> BlockGroups { get; internal set; }
|
||||
|
||||
public ObservableCollection<string> BlockGroupSuggestions { get; internal set; }
|
||||
|
||||
public string BlockGroupSearch { get; set; }
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
@@ -117,7 +132,7 @@ namespace Filtration.ViewModels
|
||||
get { return Block.BlockItems.Where(b => b is IAudioVisualBlockItem); }
|
||||
}
|
||||
|
||||
public bool AdvancedBlockGroup => Block.BlockGroup != null && Block.BlockGroup.Advanced;
|
||||
public bool AdvancedBlockGroup => Block.BlockGroup?.ParentGroup != null && Block.BlockGroup.ParentGroup.Advanced;
|
||||
|
||||
public bool AudioVisualBlockItemsGridVisible
|
||||
{
|
||||
@@ -438,6 +453,11 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBlockEnabledStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
RaisePropertyChanged(nameof(BlockEnabled));
|
||||
}
|
||||
|
||||
private void OnBlockItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
var itemFilterBlockItem = sender as IItemFilterBlockItem;
|
||||
@@ -529,5 +549,104 @@ namespace Filtration.ViewModels
|
||||
MessageBox.Show("Couldn't play the file. Please be sure it is a valid audio file.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddBlockGroupCommand()
|
||||
{
|
||||
var baseBlock = Block as ItemFilterBlock;
|
||||
if (baseBlock == null)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(BlockGroupSearch))
|
||||
{
|
||||
var blockToAdd = _parentScriptViewModel.Script.ItemFilterBlockGroups.First();
|
||||
if(BlockGroups.Count > 0)
|
||||
{
|
||||
blockToAdd = BlockGroups.Last();
|
||||
}
|
||||
|
||||
var newGroup = new ItemFilterBlockGroup(BlockGroupSearch, null, AdvancedBlockGroup, false);
|
||||
if (baseBlock.BlockGroup == null)
|
||||
{
|
||||
baseBlock.BlockGroup = new ItemFilterBlockGroup("", null, false, true);
|
||||
baseBlock.BlockGroup.IsShowChecked = baseBlock.Action == BlockAction.Show;
|
||||
baseBlock.BlockGroup.IsEnableChecked = BlockEnabled;
|
||||
}
|
||||
newGroup.AddOrJoinBlockGroup(baseBlock.BlockGroup);
|
||||
blockToAdd.AddOrJoinBlockGroup(newGroup);
|
||||
|
||||
Block.IsEdited = true;
|
||||
_parentScriptViewModel.SetDirtyFlag();
|
||||
|
||||
Messenger.Default.Send(new NotificationMessage<bool>(_parentScriptViewModel.ShowAdvanced, "BlockGroupsChanged"));
|
||||
UpdateBlockGroups();
|
||||
}
|
||||
|
||||
BlockGroupSearch = "";
|
||||
RaisePropertyChanged(nameof(BlockGroupSearch));
|
||||
}
|
||||
|
||||
private void OnDeleteBlockGroupCommand()
|
||||
{
|
||||
if(BlockGroups.Count > 0)
|
||||
{
|
||||
Block.BlockGroup.DetachSelf(false);
|
||||
BlockGroups.RemoveAt(BlockGroups.Count - 1);
|
||||
|
||||
var blockToAdd = _parentScriptViewModel.Script.ItemFilterBlockGroups.First();
|
||||
if (BlockGroups.Count > 0)
|
||||
{
|
||||
blockToAdd = BlockGroups.Last();
|
||||
}
|
||||
blockToAdd.AddOrJoinBlockGroup(Block.BlockGroup);
|
||||
|
||||
Block.IsEdited = true;
|
||||
_parentScriptViewModel.SetDirtyFlag();
|
||||
|
||||
Messenger.Default.Send(new NotificationMessage<bool>(_parentScriptViewModel.ShowAdvanced, "BlockGroupsChanged"));
|
||||
UpdateBlockGroups();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBlockGroups()
|
||||
{
|
||||
var baseBlock = Block as ItemFilterBlock;
|
||||
if (baseBlock == null)
|
||||
return;
|
||||
|
||||
var currentGroup = baseBlock.BlockGroup;
|
||||
var groupList = new List<ItemFilterBlockGroup>();
|
||||
while (currentGroup != null)
|
||||
{
|
||||
groupList.Add(currentGroup);
|
||||
currentGroup = currentGroup.ParentGroup;
|
||||
}
|
||||
|
||||
var topGroup = _parentScriptViewModel.Script.ItemFilterBlockGroups.First();
|
||||
if (groupList.Count > 1)
|
||||
{
|
||||
groupList.Reverse();
|
||||
groupList.RemoveAt(0);
|
||||
groupList.RemoveAt(groupList.Count - 1);
|
||||
|
||||
if(groupList.Count > 0)
|
||||
{
|
||||
topGroup = groupList.Last();
|
||||
}
|
||||
}
|
||||
|
||||
BlockGroups = new ObservableCollection<ItemFilterBlockGroup>(groupList);
|
||||
BlockGroupSuggestions = new ObservableCollection<string>();
|
||||
|
||||
foreach(var child in topGroup.ChildGroups)
|
||||
{
|
||||
if(!child.IsLeafNode)
|
||||
{
|
||||
BlockGroupSuggestions.Add(child.GroupName);
|
||||
}
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(BlockGroups));
|
||||
RaisePropertyChanged(nameof(BlockGroupSuggestions));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
// This assumes that there will only ever be a single root node.
|
||||
return new ObservableCollection<ItemFilterBlockGroupViewModel>
|
||||
(
|
||||
new ItemFilterBlockGroupViewModel(AvalonDockWorkspaceViewModel.ActiveScriptViewModel.Script.ItemFilterBlockGroups.First(), showAdvanced, null).ChildGroups
|
||||
new ItemFilterBlockGroupViewModel(AvalonDockWorkspaceViewModel.ActiveScriptViewModel.Script.ItemFilterBlockGroups.First(), showAdvanced, null).VisibleChildGroups
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
{
|
||||
foreach (var vm in BlockGroupViewModels)
|
||||
{
|
||||
vm.IsExpanded = true;
|
||||
vm.SetIsExpandedForAll(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
{
|
||||
foreach (var vm in BlockGroupViewModels)
|
||||
{
|
||||
vm.IsExpanded = false;
|
||||
vm.SetIsExpandedForAll(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel"
|
||||
@@ -200,9 +201,47 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<WrapPanel Grid.Row="0">
|
||||
<TextBlock Text="Group" VerticalAlignment="Center" FontWeight="Bold" />
|
||||
<ItemsControl ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding BlockGroups}"
|
||||
BorderThickness="0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel IsItemsHost="True" Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text=" > " FontWeight="ExtraBold" />
|
||||
<TextBlock Text="{Binding GroupName}" />
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Button Height="10" Command="{Binding DeleteBlockGroupCommand}" Content="{StaticResource DeleteIcon}" ToolTip="Delete"
|
||||
Background="Transparent" BorderThickness="0" Margin="2,3,0,0" VerticalAlignment="Top">
|
||||
<Button.Style>
|
||||
<Style TargetType="{x:Type Button}" >
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<toolkit:AutoCompleteBox ItemsSource="{Binding BlockGroupSuggestions}" Text="{Binding BlockGroupSearch, Mode=TwoWay}"
|
||||
MinWidth="100" Margin="5,0,0,0" BorderThickness="0, 0, 0, 1" FilterMode="Contains"
|
||||
PreviewKeyDown="AutoCompleteBox_PreviewKeyDown" />
|
||||
<Button Height="12" Command="{Binding AddBlockGroupCommand}" Content="{StaticResource AddIcon}"
|
||||
ToolTip="Add" Background="Transparent" BorderThickness="0" Margin="3,0,0,0" />
|
||||
</WrapPanel>
|
||||
|
||||
<Grid Grid.Row="0" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource InverseBooleanVisibilityConverter}}">
|
||||
<Grid Grid.Row="1" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource InverseBooleanVisibilityConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
@@ -285,7 +324,7 @@
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource BooleanVisibilityConverter}}">
|
||||
<Grid Grid.Row="1" Visibility="{Binding AudioVisualBlockItemsGridVisible, Converter={StaticResource BooleanVisibilityConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
@@ -339,7 +378,7 @@
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" Margin="0,5,0,5">
|
||||
<Grid Grid.Row="2" Margin="0,5,0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
@@ -20,5 +20,15 @@ namespace Filtration.Views
|
||||
|
||||
BlockExpander.IsExpanded = !BlockExpander.IsExpanded;
|
||||
}
|
||||
|
||||
private void AutoCompleteBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
System.Windows.Controls.AutoCompleteBox box = sender as System.Windows.Controls.AutoCompleteBox;
|
||||
dynamic viewModel = box.DataContext;
|
||||
viewModel.AddBlockGroupCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,11 @@
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type viewModels:ItemFilterBlockGroupViewModel}" ItemsSource="{Binding ChildGroups}">
|
||||
<HierarchicalDataTemplate DataType="{x:Type viewModels:ItemFilterBlockGroupViewModel}" ItemsSource="{Binding VisibleChildGroups}">
|
||||
<WrapPanel>
|
||||
<CheckBox IsThreeState="True" IsChecked="{Binding IsChecked}" Click="BlockGroupCheckBox_Clicked" />
|
||||
<TextBlock Text="{Binding GroupName}" VerticalAlignment="Center" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" />
|
||||
<CheckBox IsThreeState="True" IsChecked="{Binding IsShowChecked}" Click="BlockGroupCheckBox_Clicked" ToolTip="Show/Hide" />
|
||||
<CheckBox IsThreeState="True" IsChecked="{Binding IsEnableChecked}" Click="BlockGroupCheckBox_Clicked" ToolTip="Enable/Disable" />
|
||||
<TextBlock Text="{Binding GroupName}" VerticalAlignment="Center" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" />
|
||||
</WrapPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
|
||||
Reference in New Issue
Block a user