diff --git a/Filtration/Converters/BlockItemToRemoveEnabledVisibilityConverter.cs b/Filtration/Converters/BlockItemToRemoveEnabledVisibilityConverter.cs new file mode 100644 index 0000000..e0a1b30 --- /dev/null +++ b/Filtration/Converters/BlockItemToRemoveEnabledVisibilityConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using Filtration.ObjectModel.BlockItemBaseTypes; + +namespace Filtration.Converters +{ + public class BlockItemToRemoveEnabledVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var actionBlock = value as ActionBlockItem; + + return actionBlock != null ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index 2cd8a50..bd56f1f 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -137,6 +137,7 @@ + @@ -158,6 +159,9 @@ + + BlockItemControl.xaml + EditableListBoxControl.xaml @@ -192,6 +196,10 @@ SettingsPageView.xaml + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Filtration/UserControls/BlockItemControl.xaml b/Filtration/UserControls/BlockItemControl.xaml new file mode 100644 index 0000000..c589cdd --- /dev/null +++ b/Filtration/UserControls/BlockItemControl.xaml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Show + Hide + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Filtration/UserControls/BlockItemControl.xaml.cs b/Filtration/UserControls/BlockItemControl.xaml.cs new file mode 100644 index 0000000..f5a1932 --- /dev/null +++ b/Filtration/UserControls/BlockItemControl.xaml.cs @@ -0,0 +1,83 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows; +using Filtration.Annotations; +using Filtration.ObjectModel; +using Filtration.ObjectModel.BlockItemBaseTypes; +using GalaSoft.MvvmLight.CommandWpf; + +namespace Filtration.UserControls +{ + public partial class BlockItemControl : INotifyPropertyChanged + { + public BlockItemControl() + { + InitializeComponent(); + // ReSharper disable once PossibleNullReferenceException + (Content as FrameworkElement).DataContext = this; + } + + public static readonly DependencyProperty BlockItemProperty = DependencyProperty.Register( + "BlockItem", + typeof(IItemFilterBlockItem), + typeof(BlockItemControl), + new FrameworkPropertyMetadata()); + + public static readonly DependencyProperty RemoveItemCommandProperty = DependencyProperty.Register( + "RemoveItemCommand", + typeof(RelayCommand), + typeof(BlockItemControl), + new FrameworkPropertyMetadata()); + + public static readonly DependencyProperty RemoveEnabledProperty = DependencyProperty.Register( + "RemoveEnabled", + typeof(Visibility), + typeof(BlockItemControl), + new FrameworkPropertyMetadata()); + + public IItemFilterBlockItem BlockItem + { + get + { + return (IItemFilterBlockItem)GetValue(BlockItemProperty); + } + set + { + SetValue(BlockItemProperty, value); + OnPropertyChanged(); + } + } + + public RelayCommand RemoveItemCommand + { + get + { + return (RelayCommand)GetValue(RemoveItemCommandProperty); + } + set + { + SetValue(RemoveItemCommandProperty, value); + } + } + public Visibility RemoveEnabled + { + get + { + return (Visibility)GetValue(RemoveEnabledProperty); + } + set + { + SetValue(RemoveEnabledProperty, value); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + [NotifyPropertyChangedInvocator] + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + var handler = PropertyChanged; + if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/Filtration/UserControls/ItemPreviewControl.xaml.cs b/Filtration/UserControls/ItemPreviewControl.xaml.cs index 9b0ee7c..4c277d0 100644 --- a/Filtration/UserControls/ItemPreviewControl.xaml.cs +++ b/Filtration/UserControls/ItemPreviewControl.xaml.cs @@ -11,7 +11,6 @@ namespace Filtration.UserControls InitializeComponent(); // ReSharper disable once PossibleNullReferenceException (Content as FrameworkElement).DataContext = this; - } public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register( diff --git a/Filtration/Views/ItemFilterBlockView.xaml b/Filtration/Views/ItemFilterBlockView.xaml index a2bdac5..92ec818 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml +++ b/Filtration/Views/ItemFilterBlockView.xaml @@ -7,10 +7,7 @@ xmlns:userControls="clr-namespace:Filtration.UserControls" xmlns:views="clr-namespace:Filtration.Views" xmlns:converters="clr-namespace:Filtration.Converters" - xmlns:extensions="clr-namespace:Filtration.Extensions" xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel" - xmlns:blockItemTypes="clr-namespace:Filtration.ObjectModel.BlockItemTypes;assembly=Filtration.ObjectModel" - xmlns:enums="clr-namespace:Filtration.ObjectModel.Enums;assembly=Filtration.ObjectModel" xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase" mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterBlockViewModel}" @@ -22,7 +19,6 @@ - @@ -210,121 +206,11 @@ - - - - - - Show - Hide - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Filtration/Views/SharedResourcesDictionary.xaml b/Filtration/Views/SharedResourcesDictionary.xaml index 37c1e9d..b4a4fbb 100644 --- a/Filtration/Views/SharedResourcesDictionary.xaml +++ b/Filtration/Views/SharedResourcesDictionary.xaml @@ -39,6 +39,7 @@ +