Hi Team,
Please consider adding Open/Closed event for the comboBox's popup. The validation for this is I need to perform validation if a user closes the popup without making a selection.
SelectionChanged doesn't work here, because user never selected anything. Focus events are very finnicky because of the platform differences and input modalities.
The only sane options is to add an official PopupClosed event (and you don't even need custom EventArgs).
Thank you!
Bobby
Workaround
For now, I am using reflection+ nonPublic|Instance BindingFields to get a reference to the private RadPopup field of the RadComboBox. With that reference, I am subscribing to PropertyChanged and watching for value changes of the IsOpen property.
It goes without saying, this is a very resource intensive and unofficial approach.
public partial class MainPage : ContentPage
{
private RadPopup internalPopup;
public MainPage()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
var popup = typeof(RadComboBox).GetField("popup", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(ComboBox1);
if (popup is RadPopup p1)
{
internalPopup = p1;
internalPopup.PropertyChanged += InternalPopup_PropertyChanged;
}
}
private void InternalPopup_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName != nameof(RadPopup.IsOpen))
return;
if (internalPopup.IsOpen)
{
// Popup was opened
}
else
{
// Popup was closed
}
}
protected override void OnDisappearing()
{
if (internalPopup != null)
internalPopup.PropertyChanged -= InternalPopup_PropertyChanged;
base.OnDisappearing();
}
}