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
Is your feature request related to a problem? Please describe.
I would prefer a generic method than casting inline so I created a custom UIElementExtension class to do that. I Thought it could be added to Stride as well. This is simply a nice to have feature to match InstantiateElement<T>. When using UILibraries .
The use case is I am always trying to get named subcomponents of the UIElements when setting up UI behavior in code, and it would be nice if I could get the function to retrieve the type of UI element I am trying to find rather than casting it in the setup game logic.
Describe the solution you'd like
Implement this function into UIElement
public T FindName<T>(string name) where T: UIElement
{
return (T)FindName(name);
}
Describe alternatives you've considered
I am currently using
using Stride.UI;
public static class UIElementExtension
{
public static T FindName<T>(this UIElement uiElement, string name) where T: UIElement
{
return (T)uiElement.FindName(name);
}
}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I would prefer a generic method than casting inline so I created a custom UIElementExtension class to do that. I Thought it could be added to Stride as well. This is simply a nice to have feature to match
InstantiateElement<T>
. When usingUILibraries
.The use case is I am always trying to get named subcomponents of the
UIElements
when setting up UI behavior in code, and it would be nice if I could get the function to retrieve the type of UI element I am trying to find rather than casting it in the setup game logic.Describe the solution you'd like
Implement this function into
UIElement
Describe alternatives you've considered
I am currently using
The text was updated successfully, but these errors were encountered: