(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity
up vote
0
down vote
favorite
I'm having a problem with binding in MvvmCross and Xamarin Forms. When I'm navigating from my MainViewModel to FileInfoViewModel, I'm getting following error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity
I have used MvvmCross setup like described here
This is my RootActivity.cs code in Android project:
[Activity(Label = "XFCubage", Icon = "@mipmap/icon", Theme = "@style/MainTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class RootActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<Core.App, App>, Core.App, App>
{
protected override void OnCreate(Bundle savedInstanceState)
{
CrossCurrentActivity.Current.Activity = this;
base.OnCreate(savedInstanceState);
}
}
This is my FileInfoViewModel.cs that I'm navigating from MainViewModel (during navigation, I'm passing object InfoDetail):
namespace XFCubage.Core.ViewModels
{
public class FileInfoViewModel : MvxViewModel<InfoDetail>
{
public ObservableCollection<SideMenuItem> MenuItems { get; set; }
public InfoDetail Detail { get; private set; }
public SideMenuItem SelectedMenuItem { get; set; }
private int _sideMenuWidth;
public int SideMenuWidth
{
get => _sideMenuWidth;
set => SetProperty(ref _sideMenuWidth, value);
}
private IMvxNavigationService _navigationService;
public FileInfoViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
InitializeSideMenuItems();
CrossDeviceOrientation.Current.OrientationChanged += (sender,
args) =>
{
var orientation = args.Orientation;
SetSideMenuWidth(orientation);
};
}
void SetSideMenuWidth(DeviceOrientations orientation)
{
if (orientation == DeviceOrientations.Landscape ||
orientation == DeviceOrientations.LandscapeFlipped)
SideMenuWidth = 250;
else
SideMenuWidth = 65;
}
public void InitializeSideMenuItems()
{
MenuItems = new ObservableCollection<SideMenuItem>();
MenuItems.Add(new SideMenuItem() { Id = 1, Title = "FILE INFO", ImageSource = ImageSource.FromFile("fileinfo.png"), Selected = true });
MenuItems.Add(new SideMenuItem() { Id = 2, Title = "LOADING ADDRESS", ImageSource = ImageSource.FromFile("loadingaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 3, Title = "DELIVERY ADDRESS", ImageSource = ImageSource.FromFile("deliveryaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 4, Title = "QUOTE ADDRESS", ImageSource = ImageSource.FromFile("quoteaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 5, Title = "BILLING ADDRESS", ImageSource = ImageSource.FromFile("wallet.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 6, Title = "ROOMS", ImageSource = ImageSource.FromFile("rooms.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 7, Title = "SUMMARY", ImageSource = ImageSource.FromFile("summary.png"), Selected = false });
SelectedMenuItem = MenuItems[0];
}
public override void Prepare(InfoDetail parameter)
{
Detail = parameter;
}
}
}
This my FileInfoPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<views:MvxContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:components="clr-namespace:XFCubage.Core.Components;assembly=XFCubage.Core"
xmlns:viewModels="clr-namespace:XFCubage.Core.ViewModels;assembly=XFCubage.Core"
x:TypeArguments="viewModels:FileInfoViewModel"
x:Class="XFCubage.Views.FileInfoPage"
BackgroundColor="{StaticResource PageBackgroundColor}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<listview:SfListView ItemsSource="{Binding MenuItems}"
BackgroundColor="{StaticResource TableHeaderBackground}"
ItemSpacing="0,10,0,10"
SelectionMode="Single" SelectionGesture="Tap" SelectedItem="{Binding SelectedMenuItem, Mode=TwoWay}">
<listview:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal">
<BoxView WidthRequest="3"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.ItemTemplate>
<listview:SfListView.SelectedItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" BackgroundColor="{StaticResource SelectedItemBackgroundColor}">
<BoxView WidthRequest="3" BackgroundColor="{StaticResource HighlightColor}"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.SelectedItemTemplate>
</listview:SfListView>
</Grid>
Problem occures in this line in XAML bindin. I receive an error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity:
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
When I change this line to:
<ColumnDefinition Width="250"/>
Everything seems to be okay. The stranges thing is that binding for listview (model Detail that I'm passing from MainViewModel to FileInfoViewModel) works.
Can you please help me because I'm confused.
data-binding xamarin.forms mvvmcross
add a comment |
up vote
0
down vote
favorite
I'm having a problem with binding in MvvmCross and Xamarin Forms. When I'm navigating from my MainViewModel to FileInfoViewModel, I'm getting following error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity
I have used MvvmCross setup like described here
This is my RootActivity.cs code in Android project:
[Activity(Label = "XFCubage", Icon = "@mipmap/icon", Theme = "@style/MainTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class RootActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<Core.App, App>, Core.App, App>
{
protected override void OnCreate(Bundle savedInstanceState)
{
CrossCurrentActivity.Current.Activity = this;
base.OnCreate(savedInstanceState);
}
}
This is my FileInfoViewModel.cs that I'm navigating from MainViewModel (during navigation, I'm passing object InfoDetail):
namespace XFCubage.Core.ViewModels
{
public class FileInfoViewModel : MvxViewModel<InfoDetail>
{
public ObservableCollection<SideMenuItem> MenuItems { get; set; }
public InfoDetail Detail { get; private set; }
public SideMenuItem SelectedMenuItem { get; set; }
private int _sideMenuWidth;
public int SideMenuWidth
{
get => _sideMenuWidth;
set => SetProperty(ref _sideMenuWidth, value);
}
private IMvxNavigationService _navigationService;
public FileInfoViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
InitializeSideMenuItems();
CrossDeviceOrientation.Current.OrientationChanged += (sender,
args) =>
{
var orientation = args.Orientation;
SetSideMenuWidth(orientation);
};
}
void SetSideMenuWidth(DeviceOrientations orientation)
{
if (orientation == DeviceOrientations.Landscape ||
orientation == DeviceOrientations.LandscapeFlipped)
SideMenuWidth = 250;
else
SideMenuWidth = 65;
}
public void InitializeSideMenuItems()
{
MenuItems = new ObservableCollection<SideMenuItem>();
MenuItems.Add(new SideMenuItem() { Id = 1, Title = "FILE INFO", ImageSource = ImageSource.FromFile("fileinfo.png"), Selected = true });
MenuItems.Add(new SideMenuItem() { Id = 2, Title = "LOADING ADDRESS", ImageSource = ImageSource.FromFile("loadingaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 3, Title = "DELIVERY ADDRESS", ImageSource = ImageSource.FromFile("deliveryaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 4, Title = "QUOTE ADDRESS", ImageSource = ImageSource.FromFile("quoteaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 5, Title = "BILLING ADDRESS", ImageSource = ImageSource.FromFile("wallet.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 6, Title = "ROOMS", ImageSource = ImageSource.FromFile("rooms.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 7, Title = "SUMMARY", ImageSource = ImageSource.FromFile("summary.png"), Selected = false });
SelectedMenuItem = MenuItems[0];
}
public override void Prepare(InfoDetail parameter)
{
Detail = parameter;
}
}
}
This my FileInfoPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<views:MvxContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:components="clr-namespace:XFCubage.Core.Components;assembly=XFCubage.Core"
xmlns:viewModels="clr-namespace:XFCubage.Core.ViewModels;assembly=XFCubage.Core"
x:TypeArguments="viewModels:FileInfoViewModel"
x:Class="XFCubage.Views.FileInfoPage"
BackgroundColor="{StaticResource PageBackgroundColor}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<listview:SfListView ItemsSource="{Binding MenuItems}"
BackgroundColor="{StaticResource TableHeaderBackground}"
ItemSpacing="0,10,0,10"
SelectionMode="Single" SelectionGesture="Tap" SelectedItem="{Binding SelectedMenuItem, Mode=TwoWay}">
<listview:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal">
<BoxView WidthRequest="3"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.ItemTemplate>
<listview:SfListView.SelectedItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" BackgroundColor="{StaticResource SelectedItemBackgroundColor}">
<BoxView WidthRequest="3" BackgroundColor="{StaticResource HighlightColor}"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.SelectedItemTemplate>
</listview:SfListView>
</Grid>
Problem occures in this line in XAML bindin. I receive an error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity:
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
When I change this line to:
<ColumnDefinition Width="250"/>
Everything seems to be okay. The stranges thing is that binding for listview (model Detail that I'm passing from MainViewModel to FileInfoViewModel) works.
Can you please help me because I'm confused.
data-binding xamarin.forms mvvmcross
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having a problem with binding in MvvmCross and Xamarin Forms. When I'm navigating from my MainViewModel to FileInfoViewModel, I'm getting following error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity
I have used MvvmCross setup like described here
This is my RootActivity.cs code in Android project:
[Activity(Label = "XFCubage", Icon = "@mipmap/icon", Theme = "@style/MainTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class RootActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<Core.App, App>, Core.App, App>
{
protected override void OnCreate(Bundle savedInstanceState)
{
CrossCurrentActivity.Current.Activity = this;
base.OnCreate(savedInstanceState);
}
}
This is my FileInfoViewModel.cs that I'm navigating from MainViewModel (during navigation, I'm passing object InfoDetail):
namespace XFCubage.Core.ViewModels
{
public class FileInfoViewModel : MvxViewModel<InfoDetail>
{
public ObservableCollection<SideMenuItem> MenuItems { get; set; }
public InfoDetail Detail { get; private set; }
public SideMenuItem SelectedMenuItem { get; set; }
private int _sideMenuWidth;
public int SideMenuWidth
{
get => _sideMenuWidth;
set => SetProperty(ref _sideMenuWidth, value);
}
private IMvxNavigationService _navigationService;
public FileInfoViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
InitializeSideMenuItems();
CrossDeviceOrientation.Current.OrientationChanged += (sender,
args) =>
{
var orientation = args.Orientation;
SetSideMenuWidth(orientation);
};
}
void SetSideMenuWidth(DeviceOrientations orientation)
{
if (orientation == DeviceOrientations.Landscape ||
orientation == DeviceOrientations.LandscapeFlipped)
SideMenuWidth = 250;
else
SideMenuWidth = 65;
}
public void InitializeSideMenuItems()
{
MenuItems = new ObservableCollection<SideMenuItem>();
MenuItems.Add(new SideMenuItem() { Id = 1, Title = "FILE INFO", ImageSource = ImageSource.FromFile("fileinfo.png"), Selected = true });
MenuItems.Add(new SideMenuItem() { Id = 2, Title = "LOADING ADDRESS", ImageSource = ImageSource.FromFile("loadingaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 3, Title = "DELIVERY ADDRESS", ImageSource = ImageSource.FromFile("deliveryaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 4, Title = "QUOTE ADDRESS", ImageSource = ImageSource.FromFile("quoteaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 5, Title = "BILLING ADDRESS", ImageSource = ImageSource.FromFile("wallet.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 6, Title = "ROOMS", ImageSource = ImageSource.FromFile("rooms.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 7, Title = "SUMMARY", ImageSource = ImageSource.FromFile("summary.png"), Selected = false });
SelectedMenuItem = MenuItems[0];
}
public override void Prepare(InfoDetail parameter)
{
Detail = parameter;
}
}
}
This my FileInfoPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<views:MvxContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:components="clr-namespace:XFCubage.Core.Components;assembly=XFCubage.Core"
xmlns:viewModels="clr-namespace:XFCubage.Core.ViewModels;assembly=XFCubage.Core"
x:TypeArguments="viewModels:FileInfoViewModel"
x:Class="XFCubage.Views.FileInfoPage"
BackgroundColor="{StaticResource PageBackgroundColor}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<listview:SfListView ItemsSource="{Binding MenuItems}"
BackgroundColor="{StaticResource TableHeaderBackground}"
ItemSpacing="0,10,0,10"
SelectionMode="Single" SelectionGesture="Tap" SelectedItem="{Binding SelectedMenuItem, Mode=TwoWay}">
<listview:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal">
<BoxView WidthRequest="3"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.ItemTemplate>
<listview:SfListView.SelectedItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" BackgroundColor="{StaticResource SelectedItemBackgroundColor}">
<BoxView WidthRequest="3" BackgroundColor="{StaticResource HighlightColor}"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.SelectedItemTemplate>
</listview:SfListView>
</Grid>
Problem occures in this line in XAML bindin. I receive an error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity:
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
When I change this line to:
<ColumnDefinition Width="250"/>
Everything seems to be okay. The stranges thing is that binding for listview (model Detail that I'm passing from MainViewModel to FileInfoViewModel) works.
Can you please help me because I'm confused.
data-binding xamarin.forms mvvmcross
I'm having a problem with binding in MvvmCross and Xamarin Forms. When I'm navigating from my MainViewModel to FileInfoViewModel, I'm getting following error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity
I have used MvvmCross setup like described here
This is my RootActivity.cs code in Android project:
[Activity(Label = "XFCubage", Icon = "@mipmap/icon", Theme = "@style/MainTheme",
MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class RootActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<Core.App, App>, Core.App, App>
{
protected override void OnCreate(Bundle savedInstanceState)
{
CrossCurrentActivity.Current.Activity = this;
base.OnCreate(savedInstanceState);
}
}
This is my FileInfoViewModel.cs that I'm navigating from MainViewModel (during navigation, I'm passing object InfoDetail):
namespace XFCubage.Core.ViewModels
{
public class FileInfoViewModel : MvxViewModel<InfoDetail>
{
public ObservableCollection<SideMenuItem> MenuItems { get; set; }
public InfoDetail Detail { get; private set; }
public SideMenuItem SelectedMenuItem { get; set; }
private int _sideMenuWidth;
public int SideMenuWidth
{
get => _sideMenuWidth;
set => SetProperty(ref _sideMenuWidth, value);
}
private IMvxNavigationService _navigationService;
public FileInfoViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
InitializeSideMenuItems();
CrossDeviceOrientation.Current.OrientationChanged += (sender,
args) =>
{
var orientation = args.Orientation;
SetSideMenuWidth(orientation);
};
}
void SetSideMenuWidth(DeviceOrientations orientation)
{
if (orientation == DeviceOrientations.Landscape ||
orientation == DeviceOrientations.LandscapeFlipped)
SideMenuWidth = 250;
else
SideMenuWidth = 65;
}
public void InitializeSideMenuItems()
{
MenuItems = new ObservableCollection<SideMenuItem>();
MenuItems.Add(new SideMenuItem() { Id = 1, Title = "FILE INFO", ImageSource = ImageSource.FromFile("fileinfo.png"), Selected = true });
MenuItems.Add(new SideMenuItem() { Id = 2, Title = "LOADING ADDRESS", ImageSource = ImageSource.FromFile("loadingaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 3, Title = "DELIVERY ADDRESS", ImageSource = ImageSource.FromFile("deliveryaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 4, Title = "QUOTE ADDRESS", ImageSource = ImageSource.FromFile("quoteaddress.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 5, Title = "BILLING ADDRESS", ImageSource = ImageSource.FromFile("wallet.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 6, Title = "ROOMS", ImageSource = ImageSource.FromFile("rooms.png"), Selected = false });
MenuItems.Add(new SideMenuItem() { Id = 7, Title = "SUMMARY", ImageSource = ImageSource.FromFile("summary.png"), Selected = false });
SelectedMenuItem = MenuItems[0];
}
public override void Prepare(InfoDetail parameter)
{
Detail = parameter;
}
}
}
This my FileInfoPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<views:MvxContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:components="clr-namespace:XFCubage.Core.Components;assembly=XFCubage.Core"
xmlns:viewModels="clr-namespace:XFCubage.Core.ViewModels;assembly=XFCubage.Core"
x:TypeArguments="viewModels:FileInfoViewModel"
x:Class="XFCubage.Views.FileInfoPage"
BackgroundColor="{StaticResource PageBackgroundColor}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<listview:SfListView ItemsSource="{Binding MenuItems}"
BackgroundColor="{StaticResource TableHeaderBackground}"
ItemSpacing="0,10,0,10"
SelectionMode="Single" SelectionGesture="Tap" SelectedItem="{Binding SelectedMenuItem, Mode=TwoWay}">
<listview:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal">
<BoxView WidthRequest="3"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.ItemTemplate>
<listview:SfListView.SelectedItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" BackgroundColor="{StaticResource SelectedItemBackgroundColor}">
<BoxView WidthRequest="3" BackgroundColor="{StaticResource HighlightColor}"/>
<Image Source="{Binding ImageSource}" WidthRequest="24" HeightRequest="24" Margin="10,0,20,0"/>
<Label Text="{Binding Title}" TextColor="{StaticResource TextColor}" VerticalTextAlignment="Center"/>
</StackLayout>
</DataTemplate>
</listview:SfListView.SelectedItemTemplate>
</listview:SfListView>
</Grid>
Problem occures in this line in XAML bindin. I receive an error:
(MvvmCross.Logging.MvxLog) No view model association found for candidate view RootActivity:
<ColumnDefinition Width="{Binding SideMenuWidth}"/>
When I change this line to:
<ColumnDefinition Width="250"/>
Everything seems to be okay. The stranges thing is that binding for listview (model Detail that I'm passing from MainViewModel to FileInfoViewModel) works.
Can you please help me because I'm confused.
data-binding xamarin.forms mvvmcross
data-binding xamarin.forms mvvmcross
asked Nov 9 at 8:46
user3569465
3116
3116
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
According to your code, I don’t see where you are linking the (data) ViewModel to (UI)FileInfoPagelian, I guess it is the reason you have this error message.
Usually, I create Xamarin.Form, the UI is in xxx.xaml, connecting Viewmodel in xxx.xaml.cs, like this:
https://www.c-sharpcorner.com/article/xamarin-forms-create-mvvm-data-binding-application/
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
According to your code, I don’t see where you are linking the (data) ViewModel to (UI)FileInfoPagelian, I guess it is the reason you have this error message.
Usually, I create Xamarin.Form, the UI is in xxx.xaml, connecting Viewmodel in xxx.xaml.cs, like this:
https://www.c-sharpcorner.com/article/xamarin-forms-create-mvvm-data-binding-application/
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
add a comment |
up vote
0
down vote
According to your code, I don’t see where you are linking the (data) ViewModel to (UI)FileInfoPagelian, I guess it is the reason you have this error message.
Usually, I create Xamarin.Form, the UI is in xxx.xaml, connecting Viewmodel in xxx.xaml.cs, like this:
https://www.c-sharpcorner.com/article/xamarin-forms-create-mvvm-data-binding-application/
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
add a comment |
up vote
0
down vote
up vote
0
down vote
According to your code, I don’t see where you are linking the (data) ViewModel to (UI)FileInfoPagelian, I guess it is the reason you have this error message.
Usually, I create Xamarin.Form, the UI is in xxx.xaml, connecting Viewmodel in xxx.xaml.cs, like this:
https://www.c-sharpcorner.com/article/xamarin-forms-create-mvvm-data-binding-application/
According to your code, I don’t see where you are linking the (data) ViewModel to (UI)FileInfoPagelian, I guess it is the reason you have this error message.
Usually, I create Xamarin.Form, the UI is in xxx.xaml, connecting Viewmodel in xxx.xaml.cs, like this:
https://www.c-sharpcorner.com/article/xamarin-forms-create-mvvm-data-binding-application/
answered Nov 12 at 9:53
Cherry Bu
84628
84628
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
add a comment |
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
With MvvmCross in xaml you put: x:TypeArguments="viewModels:FileInfoViewModel"
– user3569465
Nov 13 at 7:58
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222397%2fmvvmcross-logging-mvxlog-no-view-model-association-found-for-candidate-view-ro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown