added feature - show tootip near careet
This commit is contained in:
@@ -6,13 +6,21 @@ using System.Windows.Media;
|
||||
namespace CursorLang.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Показывает элемент, только если значение совпадает с параметром.
|
||||
/// Нужен, чтобы настройки курсора и экрана не показывались одновременно.
|
||||
/// Показывает элемент, если значение совпадает с одним из перечисленных
|
||||
/// в параметре через запятую. Нужен, чтобы настройки точки привязки
|
||||
/// и настройки экрана не показывались одновременно.
|
||||
/// </summary>
|
||||
public sealed class EnumToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
value?.ToString() == parameter?.ToString() ? Visibility.Visible : Visibility.Collapsed;
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
string? current = value?.ToString();
|
||||
bool matches = parameter?.ToString()?
|
||||
.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)
|
||||
.Any(expected => expected == current) ?? false;
|
||||
|
||||
return matches ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
Binding.DoNothing;
|
||||
|
||||
Reference in New Issue
Block a user