I am starting with XamarinForms. I would like to create application which look line Facebook Messanger. The points is I am looking for tip how to achive bottom bar with buttons to navigate throught views.
I was trying to do it with CarouselPage but I dont see option to make static bottom bar. As I see CarouselPage can only contain collection of ContentPages
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:xxx"
x:Name="ThisPage"
x:Class="xxx">
<ContentPage>
<ContentPage.Content>
<Grid>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage>
<ContentPage.Content>
<Grid>
<Label Text="Page1"></Label>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage>
<ContentPage.Content>
<Grid>
<Label Text="Page2"></Label>
</Grid>
</ContentPage.Content>
</ContentPage>
</CarouselPage>
I did also try to make it as it was possible in XAML - create stacklayout at the bottom with navigation buttons and create content presenter to the rest page and dymanically change his content but it did not work as expected.
Can someone give me any tip ?:)
I think you have many ways to do it. I don't use Fb Messenger (sorry) but I have an idea of what you need.
First I will remind you that a "TabbedPage" will give give you this bottom bar on iOS but will be on the top for Android...
Next, you can use a third party component. I've already seen several in the past I think (If you 'DuckDuckGo' 'xamarin forms bottom bar' for instance you should find good things. You can try this one for example that renders the bottom bar on Android pretty well (and the native bar for iOS): Github BottomNavigationBarXF.
Finally, has you mentionned it, you can try to make your own navigation bar. It should not be difficult if you have some design skills. Make your bottom bar control that accepts "navigation buttons", then change the 'ContentPresenter.Content' property (in the page that owns your bottom bar) in response of the button clicks...
Exemple of the Github project (BottomBarNavigationXF):
(Android) (iOS)
Tell me if it's what you was looking for, or mark as answered if it's ok for you !
Related
I make a similar solution of SplitView like in a Microsoft Sample NavigationMenu
So i've got a question. How can i implement a LoginPage in project like this? I don't want to make loginPage with SplitView. I've tried to make splitview closed if my AppFrame is LoginPage, but seems like that solution is too awful.
In xaml you can overlay controls.
Instead of having a login page, have a login control which overlays on top of everything when the user is invalidated.
e.g. xaml
<Grid>
<LoginControl />
<SplitView />
</Grid>
For example in browsers I can manipulate DOM from JS.
Are there any analogue API?
Is it possible at all?
Update:
We define UI using XAML while developing UWP application.
Can I change UI defined by XAML or is it fixed forever?
You can absolutely change the UI at run time.
Add controls, remove controls, change properties, apply transforms or behaviours, restyle things. It's all possible.
As a simple example.
Given this XAML:
<Page
x:Class="SO33419586.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="TheGrid"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock>bye bye</TextBlock>
</Grid>
</Page>
we can do the following in code behind:
this.TheGrid.Background = new SolidColorBrush(Colors.Chartreuse);
this.TheGrid.Children.Clear();
this.TheGrid.Children.Add(new Button {Content = "click me"});
When run this creates a view with a green (chartreuse) background and containing a button but no textblock.
The key part here is the x:Name assigned in XAML as that makes it simple to reference controls created that way.
I've got a simple page set up:
<Page ...stuff goes here...>
<Hub>
<Hub.Header>
<views:HubHeaderView />
</Hub.Header>
<HubSection x:Name="PrimaryViewSection">
<DataTemplate>
<views:PrimaryHubView />
</DataTemplate>
</HubSection>
</Hub>
</Page>
Every time I navigate to this page, on first view and when I hit the back button after further navigation, I always get the turnstile animation. It looks really ugly since the Hub control is so wide. The problem is, I've tried clearing all the Transitions and ChildrenTransitions that I can find, and none of them seem to be the right one. What do I have to do to make the Hub not animate like this?
i want to show progress indicator in my windows phone app when System.Tray is not visible (my app is full screen). is there a simple way to show the progress indicator?
Why don't you use ProgresBar control which gives you the same result when you put it on the top of your layout? It's easy to use and looks exactly the same.
<Grid x:Name="LayoutRoot">
<!-- Your controls are here -->
<ProgressBar x:Name="MyProgressBar"
VerticalAlignment="Top"
IsIndeterminate="True" />
</Grid>
That is the benefit of showing SystemTray - you can use it for status messages and progress. If you choose not to use SystemTray, you have to add ProgressBar to the xaml of your Pages.
I have a WinRT app in which an AppBar button can be one of two buttons depending upon what is selected. Changing from one button to another is straightforward, however it is lacking the visual fluidity we strive for with WinRT.
The visual behavior I am looking for is also seen in the Mail app that ships with Windows 8. If you select a message and bring up the bottom AppBar, tapping the "Mark as Read/Unread" buttons results in a nice transform effect between the two buttons.
Does anyone know if this is a pre-rolled animation or do I have to implement it by hand (or even better, is there a solution out there already)?
The available transitions are in the Windows.UI.Xaml.Media.Animation namespace. Check out what is there and if you don't see what you are looking for then you will have to create your own.
The transition that looks most similar to me is AddDeleteThemeTransition, though the effect is only present when app bar items are added/removed and not when the app bar is opened.
Here's an example of its use
<AppBar>
<Grid>
<StackPanel x:Name="LeftPanel" Orientation="Horizontal">
<Button x:Name="Search" Style="{StaticResource SearchAppBarButtonStyle}" />
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<AddDeleteThemeTransition/>
</TransitionCollection>
</StackPanel.ChildrenTransitions>
</StackPanel>
</Grid>
</AppBar>