I am unable to set focus to either my Accept or Cancel SfButtons I render in the footertemplate of my SfPopup
In the example, the Decline button is created in the code behind.
I've tried DeclineButton.Focus(), but nothing works.
Any idea's how to do this?
I also want to have default key presses for the buttons...
Esc = cancel etc. .... how do I hook up the keypress events.
<popup:SfPopup.FooterTemplate>
<DataTemplate>
<Grid x:DataType="{x:Null}" Padding="0" BackgroundColor="{StaticResource BlackOpacityPoint01}">
<HorizontalStackLayout HorizontalOptions="Center" Spacing="6" Padding="0">
<ContentPresenter IsVisible="{Binding Source={x:Reference instance},Path=ShowDeclineButton}" Content="{Binding Source={x:Reference instance},Path=DeclineButton}" />
</HorizontalStackLayout>
</Grid>
</DataTemplate>
</popup:SfPopup.FooterTemplate>
John Taylor,
We have checked your requirement , we are currently working on it we will update you with further details on April 24, 2024.We will appreciate your patience until then.
Hi John Taylor ,
We have created a sample with Focusing the Button in the footer template , you can access the element inside the DataTemplate of footer through Behavior and set focus for the Required button. Also you can use keynavigation adding keyboard listener for button as a custom class , Please refer the below sample for more reference and let us know if you have any concerns
Regards,
Suthi Yuvaraj.
This doesn't work with sfButton..... does the SfButton not have Focus capability? (there seems to be no Focused visual state)????
If that is true, can you please add this! It is a basic requirement of a desktop application.
John Taylor
We have reviewed your query, and we would like to clarify that the Maui button receives the Focused event support for the Windows platform based on the native behavior of Windows in .NET MAUI. However, the focused event does not work for Maui Button in the Android platform. Regarding our SfButton Control, it is not possible to provide focus/unfocus support to the SfButton Control. Although we attempted to give focus to our SfButton control, it did not work because focus/unfocus events are fully supported only for editable controls in .NET MAUI. We hope this clarifies the situation.
Kindly let us know if you have any concerns.