-
Notifications
You must be signed in to change notification settings - Fork 149
Add Shell component #11
Comments
Thanks for a great work! Is there any way I could currently set |
Hi @Dreamescaper thanks! It seems that Fortunately, in Mobile Blazor Bindings there's an "escape hatch" to get to the Xamarin.Forms controls via the For example, in the Xaminals Shell sample's BearPage I changed the code to this: @inject ShellNavigationManager NavigationManager
<ContentPage @ref="bearPage">
<ScrollView>
<StackLayout>
@foreach (var animal in BearData.Bears)
{
<AnimalTemplate Animal="animal" OnClick="AnimalClicked"></AnimalTemplate>
}
</StackLayout>
</ScrollView>
</ContentPage>
@code {
Microsoft.MobileBlazorBindings.Elements.ContentPage bearPage;
protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
if (firstRender)
{
Xamarin.Forms.Shell.SetTabBarIsVisible(bearPage.NativeControl, false);
}
}
async Task AnimalClicked(Animal animal)
{
await NavigationManager.NavigateToAsync($"/beardetails/{animal.Name}");
}
} On the first "render" of this page (think of that as the first time the Xamarin.Forms controls are made to show up), it takes a reference to the current |
Oh, and yes, this is kind of cumbersome. I'll have to think about how to make this easier. Attached Properties are a very XAML-ish thing, and they do work well from regular C# (as they do in my example above), but they're not great in Blazor syntax. |
@Eilon <ContentPage Title="Page Title">
<ShellProperties NavBarIsVisible="false"
TabBarIsVisible="false" />
<StackLayout>
...
</StackLayout>
</ContentPage> (I would prefer it to be nested Shell type, so it would be |
That is a very interesting idea!!! That is a very clever way to simulate attached properties. Definitely worth exploration! |
I like what I see here. If it works I'll copy it for FlexLayout. |
The attached properties idea from @Dreamescaper is in! Thank you: https://twitter.com/original_ejl/status/1334253894772244482 |
No description provided.
The text was updated successfully, but these errors were encountered: