I have the scenario whereby a popup is used for editing a number of different items and I want to be able to set focus to a specified control.
With Xamarin controls, the following code was provided to enable this (and worked perfectly).
private void EditOrderLinePopup_Opened(object sender, EventArgs e)
{
// set focus to the "overriddenQuantity" field
var nativeObject = (object)editOrderLinePopupTablet.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name.Equals("NativeObject")).GetValue(editOrderLinePopupTablet);
var formsPopupviewContentTemplate = nativeObject.GetType().GetRuntimeFields().FirstOrDefault(x => x.Name.Equals("formsPopupViewContentTemplate")).GetValue(nativeObject);
var txtCtrl = (formsPopupviewContentTemplate as Grid).FindByName<SfNumericTextBox>("overriddenQuantity");
txtCtrl?.Focus();
}
Is there an equivalent code that will perform the same task using the MAUI SfNumericEntry control?
Thanks in advance.
Hi Vin,
We have checked your requirement, you can access the content inside the ContentTemplate, Please refer to the below code snippet for reference.
Code snippet:
private void popupLayout_Opened(object sender, EventArgs e) { var PopupView = popupLayout.GetType().GetRuntimeFields().FirstOrDefault(x=>x.Name == "PopupView")!.GetValue(popupLayout); var PopupMessageView = PopupView!.GetType().GetRuntimeFields().FirstOrDefault(x => x.Name == "PopupMessageView")!.GetValue(PopupView); var Content = (PopupMessageView as SfContentView)!.Content; if(Content is SfNumericEntry) { // content is SfNumericEntry. } } |
kindly let us know if you have any concerns,
Regards,
Suthi Yuvaraj.
Vin,
#Regarding MAUI SfNumericEntry control
We have SfNumericEntry, which allows you to enter numeric input and restricts the alphabetic input. Please refer to the below documentation for more reference.
UG Link:https://help.syncfusion.com/maui/numericentry/getting-started
Kindly let us know if we have misunderstood your requirement , if yes kindly share your exact requirement, what you are expecting in entry. Please let us know if you have any concerns.
Hi Vin,
Glad that our response did help in resolving your issue, please get back to us if you need further assistance.
Regards,
Jayashree