Merge branch 'upstreamdev' into queryPluginsUpdates

This commit is contained in:
AT
2019-12-13 18:17:11 +02:00
27 changed files with 455 additions and 153 deletions

View File

@@ -5,7 +5,6 @@ namespace Wox.ViewModel
{
public class RelayCommand : ICommand
{
private Action<object> _action;
public RelayCommand(Action<object> action)

View File

@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
@@ -197,8 +199,37 @@ namespace Wox.ViewModel
return results;
}
#endregion
#region FormattedText Dependency Property
public static readonly DependencyProperty FormattedTextProperty = DependencyProperty.RegisterAttached(
"FormattedText",
typeof(Inline),
typeof(ResultsViewModel),
new PropertyMetadata(null, FormattedTextPropertyChanged));
public static void SetFormattedText(DependencyObject textBlock, IList<int> value)
{
textBlock.SetValue(FormattedTextProperty, value);
}
public static Inline GetFormattedText(DependencyObject textBlock)
{
return (Inline)textBlock.GetValue(FormattedTextProperty);
}
private static void FormattedTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var textBlock = d as TextBlock;
if (textBlock == null) return;
var inline = (Inline)e.NewValue;
textBlock.Inlines.Clear();
if (inline == null) return;
textBlock.Inlines.Add(inline);
}
#endregion
public class ResultCollection : ObservableCollection<ResultViewModel>