Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] OnClickAsObservable for UI Toolkit #289

Open
ynaoto opened this issue Jan 13, 2025 · 1 comment
Open

[Feature Request] OnClickAsObservable for UI Toolkit #289

ynaoto opened this issue Jan 13, 2025 · 1 comment

Comments

@ynaoto
Copy link

ynaoto commented Jan 13, 2025

Thanks for the great library!
If there is an OnClickAsObservable that supports the UI Toolkit I would be very happy.

@georg-walkingtreegames
Copy link

How about using this simple extension method:

public static Observable<Button> ClickedAsObservable(this Button button)
{
    return Observable.FromEvent<Action, Button>(h => () => h(button),
        h => button.clicked += h,
        h => button.clicked -= h);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants