You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The SFML form embedded in Avalonia cannot receive any events #288
System: windows。
I used. net to create a win32 handle in Avalonia, then created a window using SFML and embedded it into the Avalonia form. The rendering and drawing are all normal, but the SFML form cannot receive any events. Is there anything that needs to be set?
publicpartialclassMainWindow:Window{publicMainWindow(){InitializeComponent();this.Loaded+=MainWindow_Loaded;}privatevoidMainWindow_Loaded(object?sender,Avalonia.Interactivity.RoutedEventArgse){varwindow=[new](http://www.google.com/search?q=new+msdn.microsoft.com) SFML.Graphics.RenderWindow(windowBox.Handle);// window.KeyPressed += Window_KeyPressed;window.MouseMoved+=Window_MouseMoved;;var circle =[new](http://www.google.com/search?q=new+msdn.microsoft.com) SFML.Graphics.CircleShape(100f){FillColor=SFML.Graphics.Color.Blue,Position=[new](http://www.google.com/search?q=new+msdn.microsoft.com) Vector2f(500,500)};window.Draw(circle);// Finally, display the rendered frame on screenwindow.Display();}
private voidWindow_MouseMoved(object?sender,SFML.Window.MouseMoveEventArgse){//Can In it}}
public class NativeEmbeddingControl : NativeControlHost
{
public IntPtr Handle {get; private set;}
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandleparent){
var handle =base.CreateNativeControlCore(parent);
Handle = handle.Handle;
Console.WriteLine($"Handle : {Handle}");return handle;}}
Activity
eXpl0it3r commentedon Mar 5, 2025
Moved the issue from CSFML to SFML.Net.
Also there's a cross post on the forum, just in case someone posts an answer there: https://en.sfml-dev.org/forums/index.php?topic=29833.0
AlaskanDruid commentedon Jun 30, 2025
Where is the window.DispatchEvents() call?