Some questions about the library #148
Replies: 3 comments 12 replies
-
I'm not sure how your question is related to
<NavigationPage>
<Popup> // Will not work
///
</Popup>
</NavigationPage> You need to create this element without any parent, and then invoke method This method was created for this rare case when you can't put element as some other element child. Per my understanding, that's will happen mostly in navigation scenarios, therefore this method is in Navigation type. |
Beta Was this translation helpful? Give feedback.
-
Yes, it's a bit different paradigm with Blazor components. You don't usually inherit from other components in day-to-day usage (unless you're building your own component library). In most case - you build component based on other component. In MAUI - it's the opposite. You need to have a new page - you inherid from NavigationPage. Etc. Still, let me know if you have any issues with it, as I'm not sure what causes you troubles. Regarding <Detents>
<RatioDetent IsDefault="true" Ratio="0.5f" />
<FullscreenDetent />
</Detents> |
Beta Was this translation helpful? Give feedback.
-
Sorry but I need guidance. I'm trying to add "Scoped" styles using XAML. I have this Component:
I'm trying to set the resources on the partial class of it: public partial class MoreOptionsBottomSheet
{
private static readonly ResourceDictionary Resources = [];
static MoreOptionsBottomSheet()
{
Resources.Scoped("Elements/BottomSheet/MoreOptionsBottomSheet.razor.xaml");
}
} And this is the extension: public static class ResourceDictionaryLoader
{
public static ResourceDictionary Scoped(this ResourceDictionary dictionary, string resourcePath, Assembly? containingAssembly = null)
{
var uri = new Uri(resourcePath, UriKind.Relative);
var assembly = containingAssembly ?? Assembly.GetCallingAssembly();
dictionary.SetAndLoadSource(uri, resourcePath, assembly, null);
return dictionary;
}
} I expect the button to have a transparent background, but instead they are set with the primary color. I'm sorry if this is a stupid question but I'm just learning MAUI and XAML and don't know if this is possible in Blazor Bindings or not |
Beta Was this translation helpful? Give feedback.
-
Auto Binding of '@ref'
I haven't fully understood how the 'ref' property works. With the library's "native" components, it seems to function correctly, but for third-party components, a different solution needs to be applied:
This function allows you to build the full RenderTree of a third-party component while also handling the 'ref' binding. For example:
I don't understand this part because the 'BuildElement' function is never used within the BlazorBindings.Maui library components.
Can't this be auto-detected from the generator or at least specified in some way through the attribute?
Inheritance in Third-Party Components
When creating third-party components, it is not straightforward to inherit from the "Wrap" component because the default properties that are set do not match the ones applied. An example is with the library The49.Maui.BottomSheet. To create a simple BottomSheet, you need to "wrap" it instead of inheriting it, as suggested in the documentation:
Current Implementation
Library Documentation
This is proposed as an inheritance, not a wrap.
Currently, the Detents property has been converted into a RenderFragment, but if it had remained of its original type, we could have extended the object through inheritance:
In this case, the issue is the properties not being updated after binding, leaving the default values instead.
The same applies with this function for third party components, I need to create manually a partial class just to specify this method on the render fragments elements:
Beta Was this translation helpful? Give feedback.
All reactions