Category / Section
How to open a popup while clicking anywhere in the TextBox in SfMultiColumnDropDownControl
1 min read
How to open a popup while clicking anywhere in the TextBox in SfMultiColumnDropDownControl
By default, SfMultiColumnDropDownControl does not allow you to open a popup while clicking anywhere in the TextBox.
But, this can be achieved by wiring the Loaded event of SfMultiColumnDropDownControl and by setting the IsDropDown property to true in the PreviewMouseLeftButtonUp event of TextBox as follows.
C#
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.MultiColumnControl.Loaded += MultiColumnControl_Loaded; } void MultiColumnControl_Loaded(object sender, RoutedEventArgs e) { TextBox textBox = (TextBox)GridUtil.FindDescendantChildByType(MultiColumnControl, typeof(TextBox)); //Wire PreviewMouseLeftButtonUp Event of TextBox. textBox.PreviewMouseLeftButtonUp += textBox_PreviewMouseLeftButtonUp; } void textBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { this.MultiColumnControl.IsDropDownOpen = true; } protected override void OnClosing(CancelEventArgs e) { TextBox textBox = (TextBox)GridUtil.FindDescendantChildByType(MultiColumnControl, typeof(TextBox)); textBox.PreviewMouseLeftButtonUp -= textBox_PreviewMouseLeftButtonUp; this.MultiColumnControl.Loaded -= MultiColumnControl_Loaded; } }
Sample: