[英]In wpf How to bind dynamic textbox in listbox
I created a Listbox in XAML page. 我在XAML页面中创建了一个Listbox。 when I click the listbox double click it will turns the listitem to textbox.I want to modify the text using textbox. 当我单击列表框双击它会将listitem转为textbox。我想使用文本框修改文本。 when click the enter button, the textbox turns to listitem. 单击“输入”按钮时,文本框将变为listitem。
private void lstbxindex_MouseDoubleClick(object sender,MouseButtonEventArgs e)
{
System.Windows.Controls.TextBox txtNumber = new System.Windows.Controls.TextBox();
txtNumber.Name = "ProjectlistItems";
tb.KeyDown += new System.Windows.Forms.KeyEventHandler(tb_KeyDown);
}
private static void tb_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
txtNumber.Text = lstbxindex.SelectedItem.ToString();
lstbxindex.Items.Add(txtNumber);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.