本文整理匯總了C#中System.Windows.Controls.TextBox.SetResourceReference方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBox.SetResourceReference方法的具體用法?C# TextBox.SetResourceReference怎麽用?C# TextBox.SetResourceReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Controls.TextBox
的用法示例。
在下文中一共展示了TextBox.SetResourceReference方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: btnEditCargo_Click
private void btnEditCargo_Click(object sender, RoutedEventArgs e)
{
double rate = 1;
if (GameObject.GetInstance().CurrencyCountry != null)
{
CountryCurrency currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime);
rate = currency == null ? 1 : currency.Rate;
}
TextBox tbCargoPrice = new TextBox();
tbCargoPrice.Text = string.Format("{0:0.00}", this.CargoPrice * rate);
tbCargoPrice.TextAlignment = TextAlignment.Left;
tbCargoPrice.Width = 100;
tbCargoPrice.Background = Brushes.Transparent;
tbCargoPrice.SetResourceReference(TextBox.ForegroundProperty, "TextColor");
tbCargoPrice.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PanelNewRoute", "1008"), tbCargoPrice) == PopUpSingleElement.ButtonSelected.OK && tbCargoPrice.Text.Length > 0)
{
this.CargoPrice = Convert.ToDouble(tbCargoPrice.Text) / rate;
txtCargo.Text = new ValueCurrencyConverter().Convert(this.CargoPrice).ToString();
}
}