C# WPF使用combobox.Template在组合框内查找文本框控件
这个问题延伸到 在我的窗口中添加C# WPF使用combobox.Template在组合框内查找文本框控件,c#,wpf,combobox,C#,Wpf,Combobox,这个问题延伸到 在我的窗口中添加UserControl,如下所示 <Usercontrols:MultiSelectComboBox x:Name="multiCombo" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="235" Margin="81,27,0,0"/> 您可以强制转换textchangedventargs的OriginalSource属性: private void mu
UserControl
,如下所示
<Usercontrols:MultiSelectComboBox x:Name="multiCombo" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="235" Margin="81,27,0,0"/>
您可以强制转换
textchangedventargs
的OriginalSource
属性:
private void multiCombo_TextChange(object sender, TextChangedEventArgs e)
{
TextBox textBox = e.OriginalSource as TextBox;
//...
}
您可以强制转换
textchangedventargs
的OriginalSource
属性:
private void multiCombo_TextChange(object sender, TextChangedEventArgs e)
{
TextBox textBox = e.OriginalSource as TextBox;
//...
}
它是用户控件名。在弹出窗口打开之前,不会创建文本框控件。multiCombo\u TextChange事件处理程序连接在哪里?好的,但打开弹出窗口后,我将在文本框中输入一些文本,根据该文本框,它将过滤我可以写入的内容。这是用户控件名称。在打开弹出窗口之前,不会创建文本框控件。multiCombo_TextChange事件处理程序连接在哪里?好的,但打开弹出窗口后,我将在文本框中输入一些文本,基于该文本框应该会过滤我可以编写的文本,并且我可以作为comobox
+发送方{WpfApp1.usercontrol.MultiSelectComboBox}对象{WpfApp1.usercontrol.MultiSelectComboBox}
这是我的代码,请参见我的编辑。您应该能够强制转换TextChangedEventArgs的原始源。感谢用户控件,我编写了如下事件private void TextBox\u TextChanged(object sender,TextChangedEventArgs e){//MessageBox.Show(“hi”);TextBox TextBox=e.OriginalSource as TextBox;this.TextBoxClick(TextBox,e);}
sender我作为combobox+sender{WpfApp1.usercontrol.MultiSelectComboBox}对象{WpfApp1.usercontrol.MultiSelectComboBox}
这是我的代码,请查看我的编辑。您应该能够强制转换TextChangedEventArgs的原始源。感谢用户控件,我编写了如下事件private void TextBox\u TextChanged(object sender,TextChangedEventArgs e){//MessageBox.Show(“hi”);TextBox TextBox=e.OriginalSource as TextBox;this.TextBox单击(TextBox,e);}
private void multiCombo_TextChange(object sender, TextChangedEventArgs e)
{
TextBox textBox = e.OriginalSource as TextBox;
//...
}