|
1 | 1 | using System; |
2 | 2 | using System.Collections; |
3 | 3 | using System.Collections.Generic; |
| 4 | +using System.ComponentModel; |
4 | 5 | using System.Linq; |
5 | 6 | using System.Runtime.InteropServices; |
6 | 7 | using System.Windows; |
@@ -58,7 +59,7 @@ public class MultiSelectionSearchComboBox : Control |
58 | 59 |
|
59 | 60 | public static readonly DependencyProperty SelectAllContentProperty = |
60 | 61 | DependencyProperty.Register("SelectAllContent", typeof(object), typeof(MultiSelectionSearchComboBox), |
61 | | - new PropertyMetadata("全选")); |
| 62 | + new PropertyMetadata(LanguageManager.Instance["SelectAll"])); |
62 | 63 |
|
63 | 64 | public static readonly DependencyProperty IsSelectAllActiveProperty = |
64 | 65 | DependencyProperty.Register("IsSelectAllActive", typeof(bool), typeof(MultiSelectionSearchComboBox), |
@@ -190,6 +191,7 @@ public event RoutedEventHandler Closed |
190 | 191 | public override void OnApplyTemplate() |
191 | 192 | { |
192 | 193 | base.OnApplyTemplate(); |
| 194 | + LanguageManager.Instance.PropertyChanged += Instance_PropertyChanged; |
193 | 195 | selectedList = new List<object>(); |
194 | 196 | selectedSearchList = new List<object>(); |
195 | 197 | selectedItems = new List<object>(); |
@@ -232,6 +234,10 @@ public override void OnApplyTemplate() |
232 | 234 | } |
233 | 235 | } |
234 | 236 |
|
| 237 | + private void Instance_PropertyChanged(object sender, PropertyChangedEventArgs e) |
| 238 | + { |
| 239 | + SelectAllContent = LanguageManager.Instance["SelectAll"]; |
| 240 | + } |
235 | 241 |
|
236 | 242 | private void _listBoxSearch_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) |
237 | 243 | { |
@@ -380,8 +386,8 @@ private void _listBoxSearch_SelectionChanged(object sender, SelectionChangedEven |
380 | 386 | if (e.AddedItems.Count > 0) |
381 | 387 | { |
382 | 388 | foreach (var item in e.AddedItems) |
383 | | - if (!selectedSearchList.Contains(item)) |
384 | | - selectedSearchList.Add(item); |
| 389 | + if (!_listBox.SelectedItems.Contains(item)) |
| 390 | + _listBox.SelectedItems.Add(item); |
385 | 391 | Combination(); |
386 | 392 | SelectionChecked(_listBoxSearch); |
387 | 393 | } |
|
0 commit comments