add Drawer demo
This commit is contained in:
1 parent
453839e763
commit
d145dee9c9
29 files changed
+768
-566
No files matched your search
@@ -1,11 +1,10 @@
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControl.Tools.Extension;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
@@ -18,27 +17,16 @@ namespace HandyControlDemo.UserControl
|
||||
public LeftMainContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
/*You have to ask me why I made Border special.
|
||||
What drives me crazy is that if you don't do this,
|
||||
the content of ListBoxItemBorder will always be 1 !
|
||||
How amazing!
|
||||
I wish someone could tell me why. */
|
||||
ListBoxItemBorder.Content = Properties.Langs.Lang.Border;
|
||||
}
|
||||
|
||||
private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.AddedItems.Count == 0) return;
|
||||
if (e.AddedItems[0] is TabItem tabItem &&
|
||||
VisualHelper.GetChild<ListBox>(tabItem.Content as DependencyObject) is ListBox listBox)
|
||||
if (e.AddedItems[0] is DemoInfoModel demoInfo)
|
||||
{
|
||||
if (listBox.SelectedItem != null)
|
||||
{
|
||||
var item = listBox.SelectedItem;
|
||||
listBox.SelectedIndex = -1;
|
||||
listBox.SelectedItem = item;
|
||||
}
|
||||
var selectedIndex = demoInfo.SelectedIndex;
|
||||
demoInfo.SelectedIndex = -1;
|
||||
demoInfo.SelectedIndex = selectedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +36,7 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (button.IsChecked == true)
|
||||
{
|
||||
itemsControl.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending));
|
||||
itemsControl.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -61,11 +49,12 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
if (e.Info == null) return;
|
||||
if (!(sender is FrameworkElement searchBar && searchBar.Tag is ListBox listBox)) return;
|
||||
foreach (var listBoxItem in listBox.Items.OfType<ListBoxItem>())
|
||||
foreach (DemoItemModel item in listBox.Items)
|
||||
{
|
||||
listBoxItem.Show(listBoxItem.Content.ToString().ToLower().Contains(e.Info.ToLower()) ||
|
||||
listBoxItem.Tag.ToString().Replace("DemoCtl", "").ToLower().Contains(e.Info.ToLower()));
|
||||
var listBoxItem = listBox.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
|
||||
listBoxItem?.Show(item.Name.ToLower().Contains(e.Info.ToLower()) ||
|
||||
item.TargetCtlName.Replace("DemoCtl", "").ToLower().Contains(e.Info.ToLower()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user