Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Load ContentView Content From Binding

$
0
0

As outlined by ClintStLaurent, Here in the 30th post;
forums.xamarin.com/discussion/85773/how-to-create-a-static-header

(Add Http: as I can't post links)

It's possible to have a persistent navigation header and only change the displayed ContentView.

I have tried to get this to work, I understand that I need to handle the binding and then on the button press change event, change the content view being displayed.

I am sadly, to date, unable to get it to work, I can post My code, I have so far, if required, but i will put a copy of ClintStLaurent code below (all credit to him)

Any help is appreciated.

ClintStLaurent Code (all credit to him, had to remove the two Http lines from the code, as i cant post links)

`<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="App1.MainPage"

         xmlns:local="clr-namespace:App1"
         x:Name="this"
         BindingContext="{x:Reference this}">

<Grid HorizontalOptions="FillAndExpand"
      VerticalOptions="FillAndExpand">
    <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="*" />
        <RowDefinition Height="24" />
    </Grid.RowDefinitions>

    <Grid Grid.Row="0"
          HorizontalOptions="FillAndExpand"
          BackgroundColor="Maroon">
        <!--  Basic Header  -->
        <Button HorizontalOptions="Center"
                Clicked="Button_OnClicked"
                Text="Switch" />
    </Grid>

    <Grid Grid.Row="2"
          HorizontalOptions="FillAndExpand"
          BackgroundColor="Blue">
        <!--  Dummy Footer  -->
    </Grid>



    <ContentView Grid.Row="1"
                 HorizontalOptions="Center"
                 VerticalOptions="Center"
                 Content="{Binding BoundView}" />

</Grid>

`


Viewing all articles
Browse latest Browse all 204402

Trending Articles