mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 13:35:31 +02:00
Add QueryHistory to Wox (Ctrl+Up and Ctrl+Down)
This commit is contained in:
@@ -145,26 +145,25 @@ namespace Wox
|
||||
|
||||
private void UpdateItemNumber()
|
||||
{
|
||||
VirtualizingStackPanel virtualizingStackPanel = GetInnerStackPanel(lbResults);
|
||||
int index = 0;
|
||||
for (int i = (int)virtualizingStackPanel.VerticalOffset; i <= virtualizingStackPanel.VerticalOffset + virtualizingStackPanel.ViewportHeight; i++)
|
||||
{
|
||||
index++;
|
||||
ListBoxItem item = lbResults.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
|
||||
if (item != null)
|
||||
{
|
||||
ContentPresenter myContentPresenter = FindVisualChild<ContentPresenter>(item);
|
||||
if (myContentPresenter != null)
|
||||
{
|
||||
DataTemplate dataTemplate = myContentPresenter.ContentTemplate;
|
||||
TextBlock tbItemNumber = (TextBlock)dataTemplate.FindName("tbItemNumber", myContentPresenter);
|
||||
tbItemNumber.Text = index.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
//VirtualizingStackPanel virtualizingStackPanel = GetInnerStackPanel(lbResults);
|
||||
//int index = 0;
|
||||
//for (int i = (int)virtualizingStackPanel.VerticalOffset; i <= virtualizingStackPanel.VerticalOffset + virtualizingStackPanel.ViewportHeight; i++)
|
||||
//{
|
||||
// index++;
|
||||
// ListBoxItem item = lbResults.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
|
||||
// if (item != null)
|
||||
// {
|
||||
// ContentPresenter myContentPresenter = FindVisualChild<ContentPresenter>(item);
|
||||
// if (myContentPresenter != null)
|
||||
// {
|
||||
// DataTemplate dataTemplate = myContentPresenter.ContentTemplate;
|
||||
// TextBlock tbItemNumber = (TextBlock)dataTemplate.FindName("tbItemNumber", myContentPresenter);
|
||||
// tbItemNumber.Text = index.ToString();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
private childItem FindVisualChild<childItem>(DependencyObject obj) where childItem : DependencyObject
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
|
||||
|
||||
Reference in New Issue
Block a user