本文整理汇总了C#中TextBox.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.SetValue方法的具体用法?C# TextBox.SetValue怎么用?C# TextBox.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBox
的用法示例。
在下文中一共展示了TextBox.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetWatermark
public static void SetWatermark(TextBox element, string watermark)
{
element.SetValue(WatermarkProperty, watermark);
}
示例2: CreateNewTab
private void CreateNewTab(string ChatTitle)
{
//CREATE HEADER FOR TAB ITEM
StackPanel stHeader = new StackPanel();
stHeader.Orientation = Orientation.Horizontal;
stHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
TextBlock tbHeader = new TextBlock();
Button btnClose = new Button();
btnClose.Margin = new Thickness(3, 0, 0, 0);
btnClose.Content = "X";
btnClose.Background = Brushes.Red;
btnClose.Click += btnClose_Click;
tbHeader.Text = ChatTitle;
stHeader.Children.Add(tbHeader);
stHeader.Children.Add(btnClose);
//END CREATE HEADER FOR TAB ITEM
Grid tabGrid = new Grid();
RowDefinition rd = new RowDefinition();
tabGrid.RowDefinitions.Add(rd);
rd = new RowDefinition();
rd.Height = new GridLength(150, GridUnitType.Pixel);
tabGrid.RowDefinitions.Add(rd);
TextBox tbInput = new TextBox();
tbInput.Margin = new Thickness(3, 3, 3, 3);
tbInput.BorderThickness = new Thickness(2);
tbInput.BorderBrush = Brushes.Black;
tbInput.MaxLength = 299;
tbInput.TextWrapping = TextWrapping.Wrap;
tbInput.AcceptsReturn = true;
tbInput.SetValue(Grid.RowProperty, 1);
tbInput.KeyDown += tb_InputKeyDown;
RichTextBox rtbOutput = new RichTextBox();
rtbOutput.Margin = new Thickness(3, 3, 3, 3);
rtbOutput.BorderThickness = new Thickness(2);
rtbOutput.BorderBrush = Brushes.Black;
rtbOutput.IsReadOnly = true;
rtbOutput.SetValue(Grid.RowProperty, 0);
rtbOutput.Tag = this._dal.GetLastMessageId(ChatTitle);
tabGrid.Children.Add(tbInput);
tabGrid.Children.Add(rtbOutput);
Chat chatBound = this._dal.GetChatFromTitle(ChatTitle);
TabItem ti = new TabItem();
ti.Header = stHeader;
ti.Content = tabGrid;
ti.Tag = chatBound;
this.tcChatTabs.Items.Add(ti);
((TabItem)this.tcChatTabs.Items[this.tcChatTabs.Items.Count - 1]).Focus();
}
示例3: SetCommitOnTyping
public static void SetCommitOnTyping(TextBox target, bool value)
{
target.SetValue(CommitOnTypingProperty, value);
}
示例4: SetRollbackOnEscape
public static void SetRollbackOnEscape(TextBox target, bool value)
{
target.SetValue(RollbackOnEscapeProperty, value);
}
示例5: SetCommitOnEnter
public static void SetCommitOnEnter(TextBox target, bool value)
{
target.SetValue(CommitOnEnterProperty, value);
}