private void ItemFeeInput_GotFocus(object sender, RoutedEventArgs e)
 {
     Xceed.Wpf.Toolkit.WatermarkTextBox t
         = (Xceed.Wpf.Toolkit.WatermarkTextBox)ItemFeeInput.Template.FindName("PART_TextBox", ItemFeeInput);
     if (t != null)
     {
         t.TextChanged += new TextChangedEventHandler(ItemFeeInput_TextChanged);
     }
 }
Exemple #2
0
 private void BenifitAmountTextBox_GotFocus(object sender, RoutedEventArgs e)
 {
     Xceed.Wpf.Toolkit.WatermarkTextBox t
         = (Xceed.Wpf.Toolkit.WatermarkTextBox)BenifitAmountTextBox.Template.FindName("PART_TextBox", BenifitAmountTextBox);
     if (t != null)
     {
         t.TextChanged += new TextChangedEventHandler(BenifitAmountTextBox_TextChanged);
     }
 }
        void loadField()
        {
            StackPanel st = new StackPanel();

            txbStateId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbStateId.Width     = 200;
            txbStateId.Margin    = new Thickness(0, 10, 0, 10);
            txbStateId.Watermark = "State ID";
            st.Children.Add(txbStateId);
            txbDistrictId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbDistrictId.Width     = 200;
            txbDistrictId.Watermark = "District ID";
            txbDistrictId.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbDistrictId);
            txbStateName           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbStateName.Width     = 200;
            txbStateName.Watermark = "State Name";
            txbStateName.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbStateName);

            txbDistrictName           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbDistrictName.Width     = 200;
            txbDistrictName.Margin    = new Thickness(0, 10, 0, 10);
            txbDistrictName.Watermark = "District Name";
            st.Children.Add(txbDistrictName);


            StackPanel stpanal = new StackPanel();

            stpanal.Orientation         = Orientation.Horizontal;
            stpanal.Margin              = new Thickness(20);
            stpanal.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            Button bt = new Button();

            bt.Name   = "btnSubmit";
            bt.Click += bt_Click;
            bt.Style  = Application.Current.FindResource("MetroButtonSubmit") as Style;

            // bt.Margin = new Thickness(0, 10, 0, 10);
            bt.Margin = new Thickness(0, 0, 10, 0);
            Button btcncle = new Button();

            btcncle.Style = Application.Current.FindResource("MetroButtonClose") as Style;

            btcncle.Margin = new Thickness(30, 0, 0, 0);
            stpanal.Children.Add(bt);
            stpanal.Children.Add(btcncle);

            st.Children.Add(stpanal);


            grdField.Children.Add(st);
        }
        private void ItemFeeInput_TextChanged(object sender, TextChangedEventArgs e)
        {
            Xceed.Wpf.Toolkit.WatermarkTextBox t
                = (Xceed.Wpf.Toolkit.WatermarkTextBox)ItemFeeInput.Template.FindName("PART_TextBox", ItemFeeInput);
            Match           m = currency.Match(Utils.stripCurrencyFormatting(t.Text));
            GroupCollection g = m.Groups;

            if (t != null && m.Success)
            {
                // auto-add decimal place
                if (g[1].Length > 4 || g[3].Length > 2)
                {
                    t.Text       = "$" + g[1].Value.LimitLength(4) + "." + (g[1].Value.SubstringOrEmpty(4) + g[3].Value).LimitLength(2);
                    t.CaretIndex = t.Text.Length;
                }
            }

            // limit length to 8 to prevent typing long sequences of invalid characters
            if (t != null)
            {
                t.Text = t.Text.LimitLength(8);
            }
        }
        void loadField()
        {
            StackPanel st = new StackPanel();

            txbCityId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCityId.Width     = 200;
            txbCityId.Margin    = new Thickness(0, 10, 0, 10);
            txbCityId.Watermark = "City ID";
            st.Children.Add(txbCityId);
            txbCompanyId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyId.Width     = 200;
            txbCompanyId.Watermark = "Company ID";
            txbCompanyId.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbCompanyId);
            txbCompanyName           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyName.Width     = 200;
            txbCompanyName.Watermark = "Company Name";
            txbCompanyName.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbCompanyName);

            txbCompanyCode           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyCode.Width     = 200;
            txbCompanyCode.Margin    = new Thickness(0, 10, 0, 10);
            txbCompanyCode.Watermark = "Company Code";
            st.Children.Add(txbCompanyCode);

            txbCountryId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCountryId.Width     = 200;
            txbCountryId.Margin    = new Thickness(0, 10, 0, 10);
            txbCountryId.Watermark = "Country Id";
            st.Children.Add(txbCountryId);
            txbStateId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbStateId.Width     = 200;
            txbStateId.Watermark = "State Id";
            txbStateId.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbStateId);
            txbDistrictId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbDistrictId.Width     = 200;
            txbDistrictId.Watermark = "District Id";
            txbDistrictId.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbDistrictId);

            txbOwnerName           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbOwnerName.Width     = 200;
            txbOwnerName.Margin    = new Thickness(0, 10, 0, 10);
            txbOwnerName.Watermark = "Owner Name";
            st.Children.Add(txbOwnerName);

            txbOwnerEmailId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbOwnerEmailId.Width     = 200;
            txbOwnerEmailId.Margin    = new Thickness(0, 10, 0, 10);
            txbOwnerEmailId.Watermark = "Owner Email";
            st.Children.Add(txbOwnerEmailId);
            txbOwnerPhone           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbOwnerPhone.Width     = 200;
            txbOwnerPhone.Watermark = "Owner Phone";
            txbOwnerPhone.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbOwnerPhone);
            txbCompanyEmailId           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyEmailId.Width     = 200;
            txbCompanyEmailId.Watermark = "Company Email Id";
            txbCompanyEmailId.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbCompanyEmailId);

            txbCompanyAddress           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyAddress.Width     = 200;
            txbCompanyAddress.Margin    = new Thickness(0, 10, 0, 10);
            txbCompanyAddress.Watermark = "Company Address";
            st.Children.Add(txbCompanyAddress);

            txbCompanyPhoneNo           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyPhoneNo.Width     = 200;
            txbCompanyPhoneNo.Watermark = "Company Phone Number";
            txbCompanyPhoneNo.Margin    = new Thickness(0, 10, 0, 10);
            st.Children.Add(txbCompanyPhoneNo);

            txbCompanyWebsite           = new Xceed.Wpf.Toolkit.WatermarkTextBox();
            txbCompanyWebsite.Width     = 200;
            txbCompanyWebsite.Margin    = new Thickness(0, 10, 0, 10);
            txbCompanyWebsite.Watermark = "Company Website";
            st.Children.Add(txbCompanyWebsite);

            StackPanel stpanal = new StackPanel();

            stpanal.Orientation         = Orientation.Horizontal;
            stpanal.Margin              = new Thickness(20);
            stpanal.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            Button bt = new Button();

            bt.Name   = "btnSubmit";
            bt.Click += bt_Click;
            bt.Style  = Application.Current.FindResource("MetroButtonSubmit") as Style;

            // bt.Margin = new Thickness(0, 10, 0, 10);
            bt.Margin = new Thickness(0, 0, 10, 0);
            Button btcncle = new Button();

            btcncle.Style = Application.Current.FindResource("MetroButtonClose") as Style;

            btcncle.Margin = new Thickness(30, 0, 0, 0);
            stpanal.Children.Add(bt);
            stpanal.Children.Add(btcncle);

            st.Children.Add(stpanal);


            grdField.Children.Add(st);
        }