本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox类的典型用法代码示例。如果您正苦于以下问题:C# TextBox类的具体用法?C# TextBox怎么用?C# TextBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextBox类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了TextBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:keozx,项目名称:Xamarin-Forms-Labs,代码行数:31,代码来源:ExtendedEntryRenderer.cs
示例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);
}
}
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:11,代码来源:ApplyMarkupEventArgs.cs
示例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);
}
开发者ID:wcordeiro,项目名称:MobileApplications,代码行数:33,代码来源:IngredientsSearch.xaml.cs
示例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;
}
开发者ID:mbin,项目名称:Win81App,代码行数:27,代码来源:Common.cs
示例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");
}
开发者ID:abettadapur,项目名称:BellyofAuthorityMX,代码行数:28,代码来源:CommentPage.g.i.cs
示例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);
}
}
开发者ID:UnknownJoe796,项目名称:2Risky,代码行数:38,代码来源:LocalGameDialog.xaml.cs
示例7: SetAlwaysScrollToEnd
public static void SetAlwaysScrollToEnd(TextBox textBox, bool alwaysScrollToEnd)
{
if (textBox == null)
throw new ArgumentNullException(nameof(textBox));
textBox.SetValue(AlwaysScrollToEndProperty, alwaysScrollToEnd);
}
开发者ID:Jark,项目名称:FTDISample,代码行数:7,代码来源:TextBoxUtilities.cs
示例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");
}
开发者ID:sagar-sm,项目名称:Mu,代码行数:33,代码来源:Tweet.g.i.cs
示例9: TextBoxHelper
public TextBoxHelper(TextBox textBox)
{
textBox.TextChanged += (o, a) =>
{
textBox.SetValue(BindableTextProperty, textBox.Text);
};
}
开发者ID:brentedwards,项目名称:Charmed,代码行数:7,代码来源:TextBoxHelper.cs
示例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));
}
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:29,代码来源:TextField.cs
示例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");
}
开发者ID:anadobes,项目名称:Win8Tracks,代码行数:26,代码来源:HomePage.g.i.cs
示例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;
}
开发者ID:MarcFletcher,项目名称:NetworkComms.Net,代码行数:10,代码来源:ChatAppWinRT.cs
示例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;
}
}
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:27,代码来源:MainPage.xaml.cs
示例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);
}
开发者ID:AJ-COOL,项目名称:Windows-universal-samples,代码行数:30,代码来源:Scenario2.xaml.cs
示例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();
};**/
}
开发者ID:RefMashao,项目名称:InformationalApp,代码行数:26,代码来源:TextSearchFilter.cs
示例16: CreateContactFromUserInput
public Contact CreateContactFromUserInput(TextBox EmailAddress, TextBox PhoneNumber)
{
if (EmailAddress.Text.Length == 0 && PhoneNumber.Text.Length == 0)
{
NotifyUser("You must enter an email address and/or phone number.", NotifyType.ErrorMessage);
return null;
}
Contact contact = new Contact();
// Maximum length for email address is 321, enforced by XAML markup.
if (EmailAddress.Text.Length > 0)
{
ContactEmail email = new ContactEmail() { Address = EmailAddress.Text };
contact.Emails.Add(email);
}
// Maximum length for phone number is 50, enforced by XAML markup.
if (PhoneNumber.Text.Length > 0)
{
ContactPhone phone = new ContactPhone() { Number = PhoneNumber.Text };
contact.Phones.Add(phone);
}
return contact;
}
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:26,代码来源:SampleConfiguration.cs
示例17: OnApplyTemplate
protected override void OnApplyTemplate()
{
textBox = GetTemplateChild(PART_TEXT_NAME) as TextBox;
button = GetTemplateChild(PART_BUTTON_NAME) as Button;
InitEvents();
}
开发者ID:lombo75,项目名称:Template10,代码行数:7,代码来源:VoiceToTextBox.cs
示例18: SetBindableText
public static void SetBindableText(TextBox element, string value)
{
if (element != null)
{
element.SetValue(BindableTextProperty, value);
}
}
开发者ID:kamilkk,项目名称:MyVote,代码行数:7,代码来源:TextBoxHelper.cs
示例19: GetAlwaysScrollToEnd
public static bool GetAlwaysScrollToEnd(TextBox textBox)
{
if (textBox == null)
throw new ArgumentNullException(nameof(textBox));
return (bool)textBox.GetValue(AlwaysScrollToEndProperty);
}
开发者ID:Jark,项目名称:FTDISample,代码行数:7,代码来源:TextBoxUtilities.cs
示例20: Search
public static async Task Search(object sender, RoutedEventArgs e, GridView SearchResults, TextBox SearchTermText, TextBlock StatusResult, IPlatformParameters parent)
{
if (string.IsNullOrEmpty(SearchTermText.Text))
{
MessageDialog dialog = new MessageDialog("Please enter a valid search term.");
await dialog.ShowAsync();
return;
}
List<User> results = await DirectorySearcherLib.DirectorySearcher.SearchByAlias(SearchTermText.Text, parent);
if (results.Count == 0)
{
StatusResult.Text = "User Not Found. Try Another Term.";
StatusResult.Foreground = new SolidColorBrush(Windows.UI.Colors.White);
results.Add(new User());
}
else if (results[0].error != null)
{
StatusResult.Text = "Error! " + results[0].error;
StatusResult.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
}
else
{
StatusResult.Text = "Success";
StatusResult.Foreground = new SolidColorBrush(Windows.UI.Colors.Green);
}
SearchResults.ItemsSource = results;
}
开发者ID:SharpMobileCode,项目名称:NativeClient-MultiTarget-DotNet,代码行数:29,代码来源:UnivDirectoryHelper.cs
注:本文中的Windows.UI.Xaml.Controls.TextBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论