aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-21 01:07:20 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-04-21 01:07:20 +0300
commit97a784b6ce43960bdb92465b08f26d3562a4f202 (patch)
treef065b36478862b09960f02a46afcc43b4c0131da /Software/Visual_Studio/Tango.SharedUI
parent1b00bc62f17c4d8e308f99a522937c5cefbeab7a (diff)
parent5677c3d08e15bef1d6629de42b6c2749f4efcef0 (diff)
downloadTango-97a784b6ce43960bdb92465b08f26d3562a4f202.tar.gz
Tango-97a784b6ce43960bdb92465b08f26d3562a4f202.zip
MERGE!
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBox.cs272
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBoxItem.cs39
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Images/PinClose_Black.pngbin0 -> 1230 bytes
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj4
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml75
5 files changed, 306 insertions, 84 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBox.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBox.cs
index 66eaa4e14..153b36804 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBox.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBox.cs
@@ -16,35 +16,90 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.Core.Commands;
using System.ComponentModel;
+using System.Windows.Controls.Primitives;
+using System.Windows.Threading;
+using System.Diagnostics;
namespace Tango.SharedUI.Controls
{
+ internal sealed class MultiSelectComboBoxTemplateSelector : DataTemplateSelector
+ {
+ public override DataTemplate SelectTemplate(object item, DependencyObject container)
+ {
+ FrameworkElement element = container as FrameworkElement;
+ if (element != null && item != null && item is MultiSelectComboBoxItem)
+ return element.FindResource("CheckItem") as DataTemplate;
+
+ return element.FindResource("SearchItem") as DataTemplate; ;
+
+ }
+ }
+
+ [TemplatePart(Name = MultiSelectComboBox.PartEditor, Type = typeof(TextBox))]
+ [TemplatePart(Name = MultiSelectComboBox.PartPopup, Type = typeof(Popup))]
public class MultiSelectComboBox : Control
{
+ #region Fields
+ public const string PartEditor = "Edit_PART";
+ public const string PartPopup = "MultiSel_Popup";
+ private ItemsControl _items_control;
+ private bool _isLoaded;
+ #endregion
+ #region "Constructors"
+
static MultiSelectComboBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MultiSelectComboBox), new FrameworkPropertyMetadata(typeof(MultiSelectComboBox)));
}
-
public MultiSelectComboBox() : base()
{
- RemoveAllCommand = new RelayCommand((() => SelectedItemsList.Clear()), () => SelectedItemsList != null && SelectedItemsList.Count > 0);
- RemoveItemCommand = new RelayCommand<string>((item) => SelectedItemsList.Remove(item), () => SelectedItemsList != null);
- AddItemCommand = new RelayCommand<string>((item) => SelectedItemsList.Add(item));
- SearchText = "";
+ SelectedItemsList = new ObservableCollection<object>();
+ RemoveAllCommand = new RelayCommand(RemoveAllSelectedItems, CanRemoveAllSelectedItems);
+ RemoveItemCommand = new RelayCommand<MultiSelectComboBoxItem>(RemoveSelectedItem);
+ AddItemCommand = new RelayCommand<string>(AddSelectedItem);
+ SearchText = new MultiSelectComboBoxSearchItem();
+ Loaded += MultiSelectComboBox_Loaded;
+ _isLoaded = false;
+
+
}
+ #endregion
#region Properties
- public ObservableCollection<string> SelectedItemsList
+ private TextBox _editor;
+
+ public TextBox Editor
{
- get { return (ObservableCollection<string>)GetValue(SelectedItemsListProperty); }
+ get { return _editor; }
+ set { _editor = value; }
+ }
+
+ private Popup _popup;
+
+ public Popup Popup
+ {
+ get { return _popup; }
+ set { _popup = value; }
+ }
+
+ private DispatcherTimer _fetchTimer;
+
+ public DispatcherTimer FetchTimer
+ {
+ get { return _fetchTimer; }
+ set { _fetchTimer = value; }
+ }
+
+ public ObservableCollection<object> SelectedItemsList
+ {
+ get { return (ObservableCollection<object>)GetValue(SelectedItemsListProperty); }
set { SetValue(SelectedItemsListProperty, value); }
}
public static readonly DependencyProperty SelectedItemsListProperty =
- DependencyProperty.Register("SelectedItemsList", typeof(ObservableCollection<string>), typeof(MultiSelectComboBox), new PropertyMetadata(default(ObservableCollection<string>)));
+ DependencyProperty.Register("SelectedItemsList", typeof(ObservableCollection<object>), typeof(MultiSelectComboBox), new PropertyMetadata(default(ObservableCollection<object>)));
public ListCollectionView SearchItemsList
@@ -67,114 +122,223 @@ namespace Tango.SharedUI.Controls
public static readonly DependencyProperty ItemsProperty =
DependencyProperty.Register("Items", typeof(ObservableCollection<string>), typeof(MultiSelectComboBox), new PropertyMetadata(default(ObservableCollection<string>)));
-
-
+
public bool IsToggleChecked
{
get { return (bool)GetValue(IsToggleCheckedProperty); }
set { SetValue(IsToggleCheckedProperty, value); }
}
- public static readonly DependencyProperty IsToggleCheckedProperty =
- DependencyProperty.Register("IsToggleChecked", typeof(bool), typeof(MultiSelectComboBox), new PropertyMetadata(false));
-
+ public static readonly DependencyProperty IsToggleCheckedProperty =
+ DependencyProperty.Register("IsToggleChecked", typeof(bool), typeof(MultiSelectComboBox), new FrameworkPropertyMetadata(false));
- private string _searchText;
+ private MultiSelectComboBoxSearchItem _searchText;
/// <summary>
/// Gets or sets the search text of TextBox.
/// </summary>
- public string SearchText
+ public MultiSelectComboBoxSearchItem SearchText
{
get { return _searchText; }
- set {_searchText = value;
- RaisePropertyChanged("SearchText");
+ set
+ {
+ _searchText = value;
OnTextChanged();
}
}
+ #endregion
+
+ private void MultiSelectComboBox_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded)
+ {
+ ToggleButton b2 = GetTemplateChild("MultiSelToggleButton") as ToggleButton;
+ if (b2 != null)
+ {
+ // ct.LoadContent();
+ _items_control = b2.Template.FindName("SelectedItemsControl", b2) as ItemsControl;
+ if (_items_control != null)
+ {
+ var wrapPanel = _items_control.FindChild<WrapPanel>();
+ if (wrapPanel != null)
+ {
+ _items_control.Bind(ItemsControl.HeightProperty, wrapPanel, WrapPanel.ActualHeightProperty, BindingMode.OneWay);
+ _isLoaded = true;
+
+ var searchItem =(_items_control.ItemContainerGenerator.ContainerFromItem(SearchText));
+ Editor = searchItem.FindVisualChildren< TextBox>().FirstOrDefault(x => x.Name == PartEditor);
+ if (Editor != null)
+ {
+ Editor.TextChanged += OnEditorTextChanged;
+ Editor.PreviewKeyDown += OnEditorKeyDown;
+ Editor.LostFocus += OnEditorLostFocus;
+ Editor.GotFocus += OnEditorGotFocus;
+ }
+ }
+ }
+ this.GotFocus += SelTextBox_GotFocus;
+ }
+ }
+ }
void OnTextChanged()
{
if(SearchItemsList != null)
{
- if (String.IsNullOrEmpty(SearchText))
+ if (String.IsNullOrEmpty(SearchText.Text))
SearchItemsList.Filter = null;
else
- SearchItemsList.Filter = new Predicate<object>(o => ((string)o == SearchText));
+ SearchItemsList.Filter = new Predicate<object>(o => (((string)o).ToLower().Contains(SearchText.Text.ToLower())));
}
}
/// <summary>
- /// Occurs when a property has changed.
- /// </summary>
- public event PropertyChangedEventHandler PropertyChanged;
-
- /// <summary>
- /// Raises the property changed event.
- /// </summary>
- /// <param name="propName">Name of the property.</param>
- protected virtual void RaisePropertyChanged(String propName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
- }
-
-
- #endregion
-
- /// <summary>
/// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />.
/// </summary>
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (SelectedItemsList == null)
- SelectedItemsList = new ObservableCollection<string>();
+ SelectedItemsList = new ObservableCollection<object>();
+ SelectedItemsList.Add(SearchText);
+
SearchItemsList = new ListCollectionView(this.Items);
+ Popup = Template.FindName(PartPopup, this) as Popup;
+
- //ItemsControl iControl = FindName("asd") as ItemsControl;
- //iControl.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
- //iControl.ItemContainerGenerator.ContainerFromItem(null);
+ if (Popup != null)
+ {
+ Popup.StaysOpen = false;
+ Popup.Opened += OnPopupOpened;
+ Popup.Closed += OnPopupClosed;
+ }
+ }
+
+ private void OnEditorTextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (FetchTimer == null)
+ {
+ FetchTimer = new DispatcherTimer();
+ FetchTimer.Interval = TimeSpan.FromMilliseconds(500);
+ FetchTimer.Tick += OnFetchTimerTick;
+ }
+ FetchTimer.IsEnabled = false;
+ FetchTimer.Stop();
+ IsToggleChecked = true;
+
+ FetchTimer.IsEnabled = true;
+ FetchTimer.Start();
+
+ }
+
+ private void OnFetchTimerTick(object sender, EventArgs e)
+ {
+ FetchTimer.IsEnabled = false;
+ FetchTimer.Stop();
+ SearchText.Text = Editor.Text;
+ OnTextChanged();
+ }
- //for (int i = 0; i < iControl.Items.Count; i++)
- //{
- // FrameworkElement a = iControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
- //}
+ private void OnEditorKeyDown(object sender, KeyEventArgs e)
+ {
+ IsToggleChecked = true;
}
- private void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e)
+ private void OnEditorLostFocus(object sender, RoutedEventArgs e)
+ {
+ if (!IsKeyboardFocusWithin)
+ {
+ IsToggleChecked = false;
+ }
+ }
+
+ private void SelTextBox_GotFocus(object sender, RoutedEventArgs e)
+ {
+ Editor?.Focus();
+ }
+
+ private void OnEditorGotFocus(object sender, RoutedEventArgs e)
+ {
+ IsToggleChecked = true;
+ }
+
+ private void OnPopupOpened(object sender, EventArgs e)
{
}
+ private void OnPopupClosed(object sender, EventArgs e)
+ {
+ IsToggleChecked = false;
+ }
#region Commands
/// <summary>
/// The remove all command property for clear SelectedItemsList
/// </summary>
- public static DependencyProperty RemoveAllCommandProperty = DependencyProperty.Register("RemoveAllCommand", typeof(ICommand), typeof(MultiSelectComboBox));
- public ICommand RemoveAllCommand
+ public static DependencyProperty RemoveAllCommandProperty = DependencyProperty.Register("RemoveAllCommand", typeof(RelayCommand), typeof(MultiSelectComboBox));
+ public RelayCommand RemoveAllCommand
{
- get { return (ICommand)GetValue(RemoveAllCommandProperty); }
+ get { return (RelayCommand)GetValue(RemoveAllCommandProperty); }
private set { SetValue(RemoveAllCommandProperty, value); }
}
/// <summary>
/// The remove item from SelectedItemsList command property
/// </summary>
- public static DependencyProperty RemoveItemCommandProperty = DependencyProperty.Register("RemoveItemCommand", typeof(RelayCommand<string>), typeof(MultiSelectComboBox));
- public RelayCommand<string> RemoveItemCommand
+ public static DependencyProperty RemoveItemCommandProperty = DependencyProperty.Register("RemoveItemCommand", typeof(RelayCommand<MultiSelectComboBoxItem>), typeof(MultiSelectComboBox));
+ public RelayCommand<MultiSelectComboBoxItem> RemoveItemCommand
{
- get { return (RelayCommand<string>)GetValue(RemoveItemCommandProperty); }
+ get { return (RelayCommand<MultiSelectComboBoxItem>)GetValue(RemoveItemCommandProperty); }
private set { SetValue(RemoveItemCommandProperty, value); }
}
-
+ /// <summary>
+ /// The add item to SelectedItemsList command property
+ /// </summary>
public static DependencyProperty AddItemCommandProperty = DependencyProperty.Register("AddItemCommand", typeof(RelayCommand<string>), typeof(MultiSelectComboBox));
public RelayCommand<string> AddItemCommand
{
get { return (RelayCommand<string>)GetValue(AddItemCommandProperty); }
private set { SetValue(AddItemCommandProperty, value); }
}
+
+ /// <summary>
+ /// Removes the selected item.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ private void RemoveSelectedItem(IMultiSelectComboBoxItem item)
+ {
+ SelectedItemsList.Remove(item);
+ RemoveAllCommand.RaiseCanExecuteChanged();
+ }
+
+ /// <summary>
+ /// Adds the selected item.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ private void AddSelectedItem(string item)
+ {
+ if (SelectedItemsList.Any(x => (x as IMultiSelectComboBoxItem).Text == item))
+ return;
+ SelectedItemsList.Insert(SelectedItemsList.Count - 1, new MultiSelectComboBoxItem(item));
+ RemoveAllCommand.RaiseCanExecuteChanged();
+ }
+ /// <summary>
+ /// Removes all selected items.
+ /// </summary>
+ private void RemoveAllSelectedItems()
+ {
+ int index = SelectedItemsList.Count - 2;
+ while (index >= 0)
+ {
+ SelectedItemsList.RemoveAt(index--);
+ }
+ RemoveAllCommand.RaiseCanExecuteChanged();
+ }
+ private bool CanRemoveAllSelectedItems()
+ {
+ return (SelectedItemsList != null && SelectedItemsList.Count > 1);
+ }
#endregion
-
-
+
}
}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBoxItem.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBoxItem.cs
new file mode 100644
index 000000000..2dcaa977a
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectComboBoxItem.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.SharedUI.Controls
+{
+ interface IMultiSelectComboBoxItem
+ {
+ string Text { get; set; }
+ }
+
+ public class MultiSelectComboBoxItem : IMultiSelectComboBoxItem
+ {
+ public string Text { get; set; }
+ public MultiSelectComboBoxItem(string text)
+ {
+ Text = text;
+ }
+ public override string ToString()
+ {
+ return Text;
+ }
+ }
+
+ public class MultiSelectComboBoxSearchItem : IMultiSelectComboBoxItem
+ {
+ public string Text { get; set; }
+ public MultiSelectComboBoxSearchItem(string text = "")
+ {
+ Text = text;
+ }
+ public override string ToString()
+ {
+ return Text;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Images/PinClose_Black.png b/Software/Visual_Studio/Tango.SharedUI/Images/PinClose_Black.png
new file mode 100644
index 000000000..abf709cb5
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Images/PinClose_Black.png
Binary files differ
diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
index c6b17cf9a..546dbf3bb 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
+++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
@@ -79,6 +79,7 @@
<DependentUpon>HiveControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\MultiSelectComboBox.cs" />
+ <Compile Include="Controls\MultiSelectComboBoxItem.cs" />
<Compile Include="Controls\MultiSelectDataGrid.cs" />
<Compile Include="Controls\MultiSelectListBox.cs" />
<Compile Include="Controls\MultiTransitionControl.xaml.cs">
@@ -243,6 +244,9 @@
<Name>Tango.DragAndDrop</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\PinClose_Black.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
diff --git a/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml b/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
index 85e9dbb8b..ec9e86d07 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
+++ b/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
@@ -4,7 +4,7 @@
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:Tango.SharedUI.Controls">
-
+ <local:MultiSelectComboBoxTemplateSelector x:Key="MultiSelectComboBoxTemplateSelector" />
<Style TargetType="{x:Type local:MultiSelectComboBox}">
<Setter Property="Background" Value="Transparent"></Setter>
@@ -12,7 +12,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBox}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" >
+ BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -22,44 +22,59 @@
VerticalAlignment="Center"
HorizontalAlignment="Stretch" Margin="4,0,0,0" SnapsToDevicePixels="True"
Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"
- IsChecked="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=IsToggleChecked,Mode=TwoWay}">
+ IsChecked="{Binding IsToggleChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
+ >
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
- <Grid >
- <WrapPanel>
- <ItemsControl x:Name="SelectedItems" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=SelectedItemsList}">
- <ItemsControl.Template>
- <ControlTemplate TargetType="{x:Type ItemsControl}">
- <ItemsPresenter HorizontalAlignment="Stretch" />
- </ControlTemplate>
- </ItemsControl.Template>
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel IsItemsHost="True" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Button Margin="4,2" Height="25" Width="Auto" Background="Transparent" BorderThickness="0.5" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=BorderBrush}"
+ <Grid x:Name="grid" >
+ <ScrollViewer VerticalScrollBarVisibility="Auto" >
+ <ScrollViewer.Resources>
+ <Style TargetType="ScrollBar">
+ <Setter Property="Width" Value="6"/>
+ <Setter Property="MinWidth" Value="6" />
+ </Style>
+ </ScrollViewer.Resources>
+ <ItemsControl x:Name="SelectedItemsControl" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=SelectedItemsList}"
+ ItemTemplateSelector="{StaticResource MultiSelectComboBoxTemplateSelector}" MinHeight="20" VerticalAlignment="Stretch">
+ <ItemsControl.Resources>
+ <DataTemplate x:Key="CheckItem">
+ <Button Margin="2" Height="25" Width="Auto" Background="Transparent" BorderThickness="0.5" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=BorderBrush}"
Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=RemoveItemCommand}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
- <TextBlock Text="{Binding}" VerticalAlignment="Center" />
- <fa:ImageAwesome Icon="Close" Width="12" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5"/>
+ <TextBlock Text="{Binding Text}" VerticalAlignment="Center" Margin="2"/>
+ <Image Source="/Tango.SharedUI;component/Images/PinClose_Black.png" Width="10" Margin="2 2 2 0" VerticalAlignment="Center" HorizontalAlignment="Right" />
</StackPanel>
</Button>
</DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <TextBox x:Name="Edit_PART" Height="25" VerticalAlignment="Top" BorderBrush="Transparent" VerticalContentAlignment="Center" BorderThickness="0"
- Text="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox},Path=SearchText, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="2"></TextBox>
- </WrapPanel>
+ <DataTemplate x:Key="SearchItem">
+ <TextBox x:Name="Edit_PART" Height="25" MinWidth="20" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" BorderBrush="Transparent" VerticalContentAlignment="Center" BorderThickness="0"
+ Text="{Binding Text}" Margin="2" Background="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}"/>
+ </DataTemplate>
+ </ItemsControl.Resources>
+ <ItemsControl.Template>
+ <ControlTemplate TargetType="{x:Type ItemsControl}">
+ <ItemsPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
+ </ControlTemplate>
+ </ItemsControl.Template>
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel IsItemsHost="True" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left"/>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ </ItemsControl>
+ </ScrollViewer>
</Grid>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
- <Button Grid.Column=" 1" BorderBrush="Transparent" Opacity="0.05" VerticalContentAlignment="Top" Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=RemoveAllCommand}">
- <fa:ImageAwesome Icon="Times" Width="12" Foreground="{TemplateBinding Foreground}" Margin="10" VerticalAlignment="Top">
- </fa:ImageAwesome>
+ <Button Grid.Column=" 1" BorderBrush="Transparent" Opacity="0.2" VerticalContentAlignment="Top" Command="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=RemoveAllCommand}" Width="20">
+ <Grid VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="15" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <Image Grid.Row="0" Source="/Tango.SharedUI;component/Images/PinClose_Black.png" MinWidth="10" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
+ </Grid>
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
@@ -100,7 +115,7 @@
</Button>
<Popup x:Name="MultiSel_Popup" Tag="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}}" MinHeight="25" MaxHeight="600" HorizontalOffset="0" MinWidth="{TemplateBinding ActualWidth}" MaxWidth="800" Grid.ColumnSpan="2"
PlacementTarget="{Binding ElementName=MultiSelToggleButton}" Placement="Bottom" AllowsTransparency="True"
- IsOpen="{Binding RelativeSource={RelativeSource Self},Path=Tag.IsToggleChecked,Mode=TwoWay}" PopupAnimation="Slide" >
+ IsOpen="{Binding ElementName=MultiSelToggleButton,Path=IsChecked}" StaysOpen="True" PopupAnimation="Slide" >
<Border Opacity="1" Background="{TemplateBinding Background}" Padding="3" BorderThickness="1" BorderBrush="Beige">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
<ItemsControl x:Name="PropertyDisplay" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:MultiSelectComboBox}, Path=SearchItemsList}">