C#C
C#14mo ago
Robisca

WPF running .ToString() of viewmodel instead of showing the coresponding view

For the context, the app is implementing mvvm and i have: a viewmodel named CheckViewModel and a corresponding view, some base classes like BaseViewModel, ObservableObject,etc and navigation through a interface and a class that implements that interface
My problem rises when I run the app. I Expect to get the view for CheckViewModel, which have some UI elements there but instead i get on top left corner the .ToString() method from CheckViewModel.
In the App.xaml i also have a defined resource for that view
App.xaml:
<Application x:Class="WPF_UI.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:viewmodel="clr-namespace:WPF_UI.ViewModel"
             xmlns:view="clr-namespace:WPF_UI.View">
    <Application.Resources>
        <DataTemplate DataType="{x:Type viewmodel:CheckViewModel}">
            <view:CheckView />
        </DataTemplate>
    </Application.Resources>
</Application>
image.png
Was this page helpful?