Unplanned
Last Updated: 17 Sep 2025 08:47 by Seung Cheol
Seung Cheol
Created on: 17 Sep 2025 08:47
Category: ToggleButton
Type: Bug Report
0
[MacCatalyst] [iOS] Inner elements inside ToggleButton cannot be interacted with as the button consumes click events

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
    }

0 comments