这个问题是WPF ComboBox 的扩展,带有复选框和带有搜索字段的文本框UserControl在我的窗口中添加如下<Usercontrols:MultiSelectComboBox x:Name="multiCombo" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="235" Margin="81,27,0,0"/>我的组合框有如下组合框模板<ComboBox><ComboBox.Template> <ControlTemplate TargetType="ComboBox"> <Grid Name="control" > <ToggleButton x:Name="ToggleButton" Grid.Column="2" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" ClickMode="Press" HorizontalContentAlignment="Left" > <ToggleButton.Template> <ControlTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="18"/> </Grid.ColumnDefinitions> <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" Background="White" BorderBrush="Silver" BorderThickness="1,1,1,1" /> <Border x:Name="BorderComp" Grid.Column="0" CornerRadius="2" Margin="1" Background="White" BorderBrush="Black" BorderThickness="0,0,0,0" > <TextBlock Text="{Binding Path=Text,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" Background="White" Padding="3" /> </Border> <Path
1 回答
肥皂起泡泡
TA贡献1829条经验 获得超6个赞
您可以投射以下OriginalSource属性TextChangedEventArgs:
private void multiCombo_TextChange(object sender, TextChangedEventArgs e)
{
TextBox textBox = e.OriginalSource as TextBox;
//...
}
- 1 回答
- 0 关注
- 574 浏览
添加回答
举报
0/150
提交
取消