Description:
On iOS and MacCatalyst, when a RadButton is placed inside a RadToggleButton's ContentTemplate and bound to a command, the command does not execute when the nested button is tapped. The same setup works as expected on Windows and Android.
Workaround:
Override the toggle button's handler to adjust gesture recognizer behavior so that touches on the nested UIButton are not intercepted by the parent RadToggleButton.
private void Element_OnHandlerChanged(object? sender, EventArgs e)
{
#if IOS || MACCATALYST
var button = sender as RadToggleButton;
var handler = button!.Handler;
if (handler != null && handler.PlatformView is UIKit.UIView platformView)
{
this.Dispatcher.Dispatch(() =>
{
var recognizer = platformView.GestureRecognizers!.Last();
recognizer.ShouldReceiveTouch = (gestureRecognizer, touch) =>
{
var view = touch.View;
if (view is UIButton)
{
return false;
}
return true;
};
});
}
#endif
}