-1

这很简单,但是如何在 C# 中创建一个 TextBox?

我需要将它放在某个位置的 ListBox 中(在 ListBox 的最后一项之前)。

我需要新的 TextBox 来包含关于它的文本、名称和宽度的属性。

这是 .xaml 中的代码示例,我需要将TextBox其放在Image

<ListBox Margin="0,-20,0,0" Height="548" Name="listBoxNew">
    <TextBlock Name="textBlockName" Text="Name"/>
    <TextBox Name="textBoxName" Width="420" Margin="-12,0,0,0"/>
    <TextBlock Name="textBlockAdd" Text="Add" Margin="0,10,0,0"/>
    <TextBox Name="textBoxAdd" Width="420" Margin="-12,0,0,0"/>
    <Image Name="imageAdd" Source="/SecondApp%2b;component/Images/buttonAdd1.png" Height="50" Margin="0,5,0,0" Tap="imageAdd_Tap" toolkit:TiltEffect.IsTiltEnabled="True" ManipulationStarted="imageAddExersize_ManipulationStarted" ManipulationCompleted="imageAddExersize_ManipulationCompleted" />
</ListBox>
4

1 回答 1

0

试试这个:

    // Add the last item to the listbox again
    listBox.Items.Add(listBox.Items.Last());

    // Place the textbox in the previous item
    listBox.Items[listBox.Items.Count - 2] = new TextBox();
于 2013-07-18T20:46:05.280 回答