So I have my page:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyProject.Page">
<ContentView x:Name="ContextButtons"/>
</ContentPage>
and another ContentView:
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyProject.Views>
<Label Text="Hello World/>
</ContentView>
and in my code behind of my page I would like to dynamically set the value of ContextButtons
public Page()
{
InitializeComponent();
if (MyBoolean)
{
ContextButtons = new Views();
}
else
{
ContextButtons = //Something else;
}
}
But sadly this doesnt work and my page never displays. What have I missed?
also Trying
ContextButtons.Content = new Views();
doesn't work as ContextButtons is null