本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox.SelectAll方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.SelectAll方法的具体用法?C# TextBox.SelectAll怎么用?C# TextBox.SelectAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Controls.TextBox
的用法示例。
在下文中一共展示了TextBox.SelectAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: selectData
private void selectData(TextBox sender, RoutedEventArgs e)
{
sender.SelectAll();
}
示例2: DialogTextBox
/// <summary>
/// Visualizza una finestra di dialogo con TextBox
/// </summary>
public static async Task<DialogTextBoxResult> DialogTextBox(string content, string title, string box="", string ok="ok", string cancel="annulla", string sub=null, string header=null, InputScopeNameValue scopename=InputScopeNameValue.Default)
{
DialogTextBoxResult risposta = new DialogTextBoxResult();
risposta.result=false;
risposta.output=null;
StackPanel stack = new StackPanel();
if(content != null)
{
TextBlock contenuto = new TextBlock();
contenuto.Text = content;
stack.Children.Add(contenuto);
}
InputScope scope = new InputScope();
scope.Names.Add(new InputScopeName(scopename));
TextBox tb = new TextBox();
tb.Text=box;
tb.InputScope = scope;
tb.Header = header;
tb.Margin = new Thickness(0,5,0,5);
stack.Children.Add(tb);
if(sub!=null)
{
TextBlock subba = new TextBlock();
subba.Text=sub;
subba.TextWrapping = TextWrapping.Wrap;
stack.Children.Add(subba);
}
ContentDialog cd = new ContentDialog();
cd.Title = title;
cd.Content = stack;
cd.PrimaryButtonText = ok;
cd.PrimaryButtonClick+= (s, ev) =>
{
risposta.result=true;
risposta.output=tb.Text;
};
cd.SecondaryButtonText=cancel;
cd.SecondaryButtonClick+= (s, ev) =>
{
risposta.result=false;
risposta.output=null;
};
cd.Opened+=(s, ev) =>
{
tb.Focus(FocusState.Keyboard);
tb.SelectAll();
};
await cd.ShowAsync();
return risposta;
}