/* * Copyright (c) 2022 LG Electronics Inc. * SPDX-License-Identifier: LicenseRef-LGE-Proprietary */ using AuroraUIComponent.UserControls.KeyValueBase; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace AuroraUIComponent.UserControls { /// /// Interaction logic for UCKeyComboBox.xaml /// public partial class UCKeyComboBox : UCKeyValueBase { public static readonly DependencyProperty ValueItemProperty = DependencyProperty.Register( nameof(ValueItem), typeof(object), typeof(UCKeyComboBox), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault )); public object ValueItem { get { return GetValue(ValueItemProperty); } set { SetValue(ValueItemProperty, value); } } public IEnumerable ItemList { get { return (IEnumerable)GetValue(ItemListProperty); } set { SetValue(ItemListProperty, value); } } public static readonly DependencyProperty ItemListProperty = DependencyProperty.Register( nameof(ItemList), typeof(IEnumerable), typeof(UCKeyComboBox), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault )); public UCKeyComboBox() { InitializeComponent(); } protected override void KeyTextChanged(string newValue) { if (string.IsNullOrEmpty(newValue)) { // KeyText 가 없으므로, 해당 grid 의 width 를 0 으로 만든다 GridParent.ColumnDefinitions[0].Width = new GridLength(0); } } } public class InverseBoolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is bool b) return !b; return true; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is bool b) return !b; return true; } } }