本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox类的典型用法代码示例。如果您正苦于以下问题:C# TextBox类的具体用法?C# TextBox怎么用?C# TextBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextBox类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了TextBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnElementChanged
/// <summary>
/// Called when [element changed].
/// </summary>
/// <param name="e">The e.</param>
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if(Element == null )
{
return;
}
var view = (ExtendedEntry)Element;
//Because Xamarin EntryRenderer switches the type of control we need to find the right one
if (view.IsPassword)
{
_thisPasswordBox = (PasswordBox) (Control.Content as Windows.UI.Xaml.Controls.Grid).Children.FirstOrDefault(c => c is PasswordBox);
}
else
{
_thisPhoneTextBox = (TextBox) (Control.Content as Windows.UI.Xaml.Controls.Grid).Children.FirstOrDefault(c => c is TextBox);
}
SetFont(view);
SetTextAlignment(view);
SetBorder(view);
SetPlaceholderTextColor(view);
SetMaxLength(view);
SetIsPasswordRevealButtonEnabled(view);
}
示例2: ApplyToTextBox
/// <summary>
/// Применить к текстовому полю.
/// </summary>
/// <param name="box">Текстовое поле.</param>
public void ApplyToTextBox(TextBox box)
{
if (box != null)
{
box.Text = provider.SetMarkup(box.Text, tag, box.SelectionStart, box.SelectionLength);
}
}
示例3: addImage_Tapped
private void addImage_Tapped(object sender, TappedRoutedEventArgs e)
{
numIngredients++;
TextBox newTxtBox = new TextBox();
newTxtBox.Name = "Ingredient"+ numIngredients;
newTxtBox.Margin = new Thickness(10, 0, 0, 0);
if (!flagColumn)
{
newTxtBox.SetValue(Grid.RowProperty, addImage.GetValue(Grid.RowProperty));
newTxtBox.SetValue(Grid.ColumnProperty, 0);
IngredientsGrid.RowDefinitions.Add(new RowDefinition());
addImage.SetValue(Grid.RowProperty, ((int)addImage.GetValue(Grid.RowProperty) + 1));
}
else
{
newTxtBox.SetValue(Grid.RowProperty, lastRow);
newTxtBox.SetValue(Grid.ColumnProperty, 1);
lastRow++;
}
IngredientsGrid.Children.Remove(addImage);
IngredientsGrid.UpdateLayout();
IngredientsGrid.Children.Add(newTxtBox);
IngredientsGrid.UpdateLayout();
IngredientsGrid.Children.Add(addImage);
IngredientsGrid.UpdateLayout();
IngredientsPanel.UpdateLayout();
numberTxtBox++;
if(numberTxtBox % 4 == 0)
{
flagColumn = !flagColumn;
}
// IngredientsPanel.Children.Add(addImage);
}
示例4: HandleException
static public bool HandleException(Exception exception, TextBox outputField, MainPage rootPage)
{
SyndicationErrorStatus status = SyndicationError.GetStatus(exception.HResult);
if (status != SyndicationErrorStatus.Unknown)
{
outputField.Text += "The response content is not valid. " +
"Please make sure to use a URI that points to an Atom feed.\r\n";
}
else
{
WebErrorStatus webError = WebError.GetStatus(exception.HResult);
if (webError == WebErrorStatus.Unauthorized)
{
outputField.Text += "Incorrect username or password.\r\n";
}
else if (webError == WebErrorStatus.Unknown)
{
// Neither a syndication nor a web error.
return false;
}
}
rootPage.NotifyUser(exception.Message, NotifyType.ErrorMessage);
return true;
}
示例5: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///CommentPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (TheBellyofAuthority.Common.LayoutAwarePage)this.FindName("pageRoot");
commentBar = (Windows.UI.Xaml.Controls.AppBar)this.FindName("commentBar");
DeleteButton = (Windows.UI.Xaml.Controls.Button)this.FindName("DeleteButton");
EditButton = (Windows.UI.Xaml.Controls.Button)this.FindName("EditButton");
commentThread = (Windows.UI.Xaml.Controls.ListView)this.FindName("commentThread");
commentLabel = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("commentLabel");
commentBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("commentBox");
postButton = (Windows.UI.Xaml.Controls.Button)this.FindName("postButton");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
UserPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("UserPanel");
progBar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("progBar");
LabelBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LabelBox");
UserBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("UserBox");
ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
}
示例6: LocalGameDialog
/// <summary>
/// Sets up the player dialog labels and text boxes for names.
/// </summary>
public LocalGameDialog()
{
this.InitializeComponent();
PlayerNames = new List<TextBox>();
for (var i = 0; i < 6; i++)
{
var block = new TextBlock()
{
Text = "Player " + (i + 1),
Foreground = ((PlayerNumber) (i + 1)).Color(),
VerticalAlignment = VerticalAlignment.Center
};
var box = new TextBox
{
VerticalAlignment = VerticalAlignment.Center,
Height = 32,
MaxLength = 8
};
PlayerGrid.Children.Add(block);
Grid.SetColumn(block, 0);
Grid.SetRow(block, i);
PlayerGrid.Children.Add(box);
Grid.SetColumn(box, 1);
Grid.SetRow(box,i);
PlayerNames.Add(box);
}
}
示例7: SetAlwaysScrollToEnd
public static void SetAlwaysScrollToEnd(TextBox textBox, bool alwaysScrollToEnd)
{
if (textBox == null)
throw new ArgumentNullException(nameof(textBox));
textBox.SetValue(AlwaysScrollToEndProperty, alwaysScrollToEnd);
}
示例8: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
}
示例9: TextBoxHelper
public TextBoxHelper(TextBox textBox)
{
textBox.TextChanged += (o, a) =>
{
textBox.SetValue(BindableTextProperty, textBox.Text);
};
}
示例10: CreateField
public void CreateField(DetailFormHelper helper, FieldData fieldData)
{
var text = fieldData as TextFieldData;
int row;
var textBlock = helper.AddRow(text, out row);
var textBox = new TextBox
{
TextWrapping = TextWrapping.Wrap,
Text = DetailFormHelper.GetValueAsString(helper.DataElement, text.name, fieldData.defaultValue),
Margin = new Thickness(5),
};
var lineHeight = Math.Max(1, text.lineHeight);
textBox.Height = 20 * lineHeight;
if (lineHeight > 1)
{
textBlock.VerticalAlignment = VerticalAlignment.Top;
textBox.AcceptsReturn = true;
}
Grid.SetColumn(textBox, 1);
Grid.SetRow(textBox, row);
helper.GridFields.Children.Add(textBox);
helper.BindingActions.Add(
() => helper.DataElement.set(text.name, textBox.Text));
}
示例11: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (_8Tracks.Common.LayoutAwarePage)this.FindName("pageRoot");
groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("groupedItemsViewSource");
passwordPrompt = (Windows.UI.Xaml.Controls.Grid)this.FindName("passwordPrompt");
itemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("itemGridView");
itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
loginText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("loginText");
loginBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("loginBox");
passwordText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("passwordText");
passwordBox = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("passwordBox");
doneButton = (Windows.UI.Xaml.Controls.Button)this.FindName("doneButton");
ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
}
示例12: ChatAppWinRT
/// <summary>
/// Constructor for the WP8 chat app.
/// </summary>
public ChatAppWinRT(TextBox currentMessageInputBox, TextBlock chatHistory, ScrollViewer chatHistoryScroller)
: base("WinRT", ConnectionType.TCP)
{
this.CurrentMessageInputBox = currentMessageInputBox;
this.ChatHistory = chatHistory;
this.ChatHistoryScroller = chatHistoryScroller;
}
示例13: TextBox_KeyDown
private void TextBox_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
var textBox = sender as TextBox;
NewToDoItemNameTextBox = textBox;
if (!string.IsNullOrEmpty(textBox.Text)
&& textBox.Text.Length > 3)
{
if (AddNewItemConfirmButton != null)
AddNewItemConfirmButton.IsEnabled = true;
if (e.Key == Windows.System.VirtualKey.Enter)
{
// Handle 'Enter' key for keyboard users
if (e.Key == Windows.System.VirtualKey.Enter)
{
e.Handled = true;
CreateNewToDoItem(textBox);
}
}
}
else
{
if (AddNewItemConfirmButton != null)
AddNewItemConfirmButton.IsEnabled = false;
}
}
示例14: GetTextboxSelectionRect
// returns a rect for selected text
// if no text is selected, returns caret location
// textbox should not be empty
private Rect GetTextboxSelectionRect(TextBox textbox)
{
Rect rectFirst, rectLast;
if (textbox.SelectionStart == textbox.Text.Length)
{
rectFirst = textbox.GetRectFromCharacterIndex(textbox.SelectionStart - 1, true);
}
else
{
rectFirst = textbox.GetRectFromCharacterIndex(textbox.SelectionStart, false);
}
int lastIndex = textbox.SelectionStart + textbox.SelectionLength;
if (lastIndex == textbox.Text.Length)
{
rectLast = textbox.GetRectFromCharacterIndex(lastIndex - 1, true);
}
else
{
rectLast = textbox.GetRectFromCharacterIndex(lastIndex, false);
}
rectFirst.Union(rectLast);
GeneralTransform transform = textbox.TransformToVisual(null);
return transform.TransformBounds(rectFirst);
}
示例15: TextSearchFilter
public TextSearchFilter(ICollectionView filteredView, TextBox textBox)
{
string filterText = "";
/* filteredView.Filter = delegate(object obj)
{
if (string.IsNullOrEmpty(filterText))
return true;
string str = obj as string;
if (string.IsNullOrEmpty(str))
return false;
int index = str.IndexOf(filterText, 0, StringComparison.CurrentCultureIgnoreCase);
return index > -1;
};
textBox.TextChanged += delegate
{
filterText = textBox.Text;
filteredView.Refresh();
};**/
}