64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
/*
|
|
* Copyright (c) 2022 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using AuroraUIComponent.UserControls.KeyValueBase;
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace AuroraUIComponent.UserControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for UCKeyValueVertical.xaml
|
|
/// </summary>
|
|
public partial class UCKeyValueVertical : UCKeyValueNumber
|
|
{
|
|
public UCKeyValueVertical() : base()
|
|
{
|
|
InitializeComponent();
|
|
TextValue.LostFocus += TextBoxOnLostFocus;
|
|
}
|
|
|
|
private void TextBoxOnLostFocus(object sender, RoutedEventArgs e)
|
|
{
|
|
Value = ParseString2Decimal(TextValue.Text);
|
|
}
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ShowNumberKeypad(TextValue);
|
|
}
|
|
|
|
protected override void ChangeThousandSeparator(decimal value)
|
|
{
|
|
//change formatting based on this flag
|
|
if (ThousandSeparator) {
|
|
if (TextValue.Text != null) {
|
|
TextValue.Text = value.ToString("N", Culture);
|
|
}
|
|
} else {
|
|
if (TextValue.Text != null) {
|
|
TextValue.Text = value.ToString($"F", Culture);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void KeyTextChanged(string newValue)
|
|
{
|
|
if (string.IsNullOrEmpty(newValue)) {
|
|
// KeyText 가 없으므로, 해당 grid 의 width 를 0 으로 만든다
|
|
if (GridParent.ColumnDefinitions.Count > 0) {
|
|
GridParent.ColumnDefinitions[0].Width = new GridLength(0);
|
|
}
|
|
|
|
if (GridParent.RowDefinitions.Count > 0) {
|
|
GridParent.RowDefinitions[0].Height = new GridLength(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|