/* * Copyright (c) 2022 LG Electronics Inc. * SPDX-License-Identifier: LicenseRef-LGE-Proprietary */ using System; 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 UCPropertyView.xaml /// public partial class UCProperty : UserControl { public object SelectedObject { get { return this.GetValue(SelectedObjectProperty); } set { this.SetValue(SelectedObjectProperty, value); } } public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register( nameof(SelectedObject), typeof(object), typeof(UCProperty)); public string Title { get { return (string)this.GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( nameof(Title), typeof(string), typeof(UCProperty), new PropertyMetadata(string.Empty, OnTitleChange)); private static void OnTitleChange(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = d as UCProperty; view.Title = (string)e.NewValue; } public bool HideSave { get { return (bool)this.GetValue(HideSaveProperty); } set { SetValue(HideSaveProperty, value); } } public static readonly DependencyProperty HideSaveProperty = DependencyProperty.Register(nameof(HideSave), typeof(bool), typeof(UCProperty), new PropertyMetadata(false, OnHideSave)); private static void OnHideSave(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = d as UCProperty; view.ButtonSave.Visibility = (bool)e.NewValue == true ? Visibility.Hidden : Visibility.Visible; } public int GridFontSize { get { return (int)this.GetValue(GridFontSizeProperty); } set { SetValue(GridFontSizeProperty, value); } } public static readonly DependencyProperty GridFontSizeProperty = DependencyProperty.Register( nameof(GridFontSize), typeof(int), typeof(UCProperty), new UIPropertyMetadata(14)); public ICommand CMD_Save { get { return (ICommand)this.GetValue(CMD_SaveProperty); } set { SetValue(CMD_SaveProperty, value); } } public static readonly DependencyProperty CMD_SaveProperty = DependencyProperty.Register( nameof(CMD_Save), typeof(ICommand), typeof(UCProperty), new UIPropertyMetadata(null)); public UCProperty() { InitializeComponent(); } } }