本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBox.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.GetType方法的具体用法?C# TextBox.GetType怎么用?C# TextBox.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Controls.TextBox
的用法示例。
在下文中一共展示了TextBox.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveDataOfCard
public async void SaveDataOfCard()
{
SaveAndLoad DataSaverLoader = new SaveAndLoad();
CardObj DataToBeSaved = new CardObj();
StackPanel Tmp_SP = new StackPanel();
TextBox Tmp_TX = new TextBox();
//First time loop through to delete and correct empty entries
foreach (UIElement IngredientEntry in this.recipePanel.Children)
{
if (IngredientEntry.GetType() == Tmp_SP.GetType())
{
StackPanel ThisEntry = (StackPanel)IngredientEntry;
//this entry could be empty
NumberSelector NS = (NumberSelector)ThisEntry.Children[0];
UnitSelector US = (UnitSelector)ThisEntry.Children[1];
TextBox TX = (TextBox)ThisEntry.Children[2];
//non empty entry
if (NS.getSelectedValue() != "" && TX.Text.ToString() != "Drag and drop ingredient here")
{
TextBox FinalEntryBox = new TextBox();
FinalEntryBox.Text = NS.getSelectedValue() + " " + US.getSelectedValue() + " " + TX.Text;
/******INSERT TAG******/
DataToBeSaved.TagsList.Add(TX.Text);
/******INSERT TAG******/
FinalEntryBox.Width = width;
ThisEntry.Children.Clear();
StackPanel Card = (StackPanel)ThisEntry.Parent;
int index = Card.Children.IndexOf(ThisEntry);
Card.Children.Remove(ThisEntry);
Card.Children.Insert(index, FinalEntryBox);
}
//empty entry
else
{
ThisEntry.Children.Clear();
StackPanel Card = (StackPanel)ThisEntry.Parent;
Card.Children.Remove(ThisEntry);
}
}
}
//All entries should be textboxes now
disableEditing();
for (int i = 0; i < this.recipePanel.Children.Count; i++)
{
TextBox ThisEntry = (TextBox)this.recipePanel.Children[i];
DataToBeSaved.IngredientList.Add(ThisEntry.Text.ToString());
if (i == 0) //first entry is title add to tags
{
DataToBeSaved.TagsList.Add(ThisEntry.Text.ToString());
DataToBeSaved.CardTitle = ThisEntry.Text.ToString();
}
}
for (int i = 0; i < this.reversePanel.Children.Count; i++)
{
TextBox ThisEntry;
if (this.reversePanel.Children[i].GetType() == Tmp_TX.GetType())
{
ThisEntry = (TextBox)this.reversePanel.Children[i];
DataToBeSaved.InstructionList.Add(ThisEntry.Text.ToString());
if (i == 0) //first entry is title add to tags
DataToBeSaved.TagsList.Add(ThisEntry.Text.ToString());
}
}
LocalAppData AllCardsCollection = await DataSaverLoader.LoadData();
int ReplaceIndex = -1;
for (int i = 0; i < AllCardsCollection.AllCardData.Count; i++)
{
if (DataToBeSaved.CardTitle == AllCardsCollection.AllCardData[i].CardTitle)
{
ReplaceIndex = i;
break;
}
}
if (ReplaceIndex != -1) //Replace
{
AllCardsCollection.AllCardData[ReplaceIndex] = DataToBeSaved;
}
else
{
AllCardsCollection.AddCard(DataToBeSaved);
}
//.........这里部分代码省略.........