Quantcast
Channel: User Yura Babiy - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Object reference not set to an instance of an object at compile time without Null Ref Exc in XAML TabbedPage CurrentPage property [duplicate]

$
0
0

I have tabbed page in XAML document and I want to bind a CurrentPage property to my view model.

Upon compiling, I get an error in my XAML document on column 1, line 1.

When I delete binding, the error is gone.

XAML:

<?xml version="1.0" encoding="utf-8" ?><TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"            xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"            xmlns:views="clr-namespace:GitRemote.Views;assembly=GitRemote"            prism:ViewModelLocator.AutowireViewModel="True"            x:Class="GitRemote.Views.PublicRepositoryPage"            CurrentPage="{Binding CurrentTabPage, Mode=OneWayToSource}"><views:RepositoryNewsPage Title="News"/><views:FileExplorerPage Title="Code"/><!--<views:CommitsPage/><views:PublicIssuesPage/>--></TabbedPage>

ViewModel property:

private Page _currentTabPage;public Page CurrentTabPage{    get { return _currentTabPage; }    set    {        SetProperty(ref _currentTabPage, value);        MessagingCenter.Send(_currentTabPage, PublicReposCurrentTabChanged);    }}

When I bind the Title, it compiles without error.


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>