コード例 #1
0
        private void DiscountPercentTX_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (DiscountPercentTX.IsFocused && DiscountPercentTX.Text.Length > 0)
            {
                int Percent = Convert.ToInt32(DiscountPercentTX.Text);

                if (Percent > 100)
                {
                    DiscountPercentTX.Text = "100";
                    DiscountPercentTX.SelectAll();
                    Percent = 100;
                }
                decimal Discount = Math.Round((ProductSellValueTX.Number * Percent) / 100);

                DiscountValueTX.Number = Discount;
            }
            else if (DiscountPercentTX.IsFocused && DiscountPercentTX.Text.Length == 0)
            {
                DiscountPercentTX.Text = "0";
                DiscountPercentTX.SelectAll();
            }
        }
コード例 #2
0
 private void DiscountPercentTX_GotKeyboardFocus(object sender, object e)
 {
     DiscountPercentTX.SelectAll();
 }