WPF Setting Data context in Xml Invalid string error

16 Views Asked by At

When Im trying to set the data context in xaml I get this error, XDG0062 Input string was not in a correct format. Ive also tested setting it as a static resource instead but it produces the same result .NET Framework 4.8 and C# 7.3

This is the code

Xaml

<UserControl x:Class="Software.Main.StatusView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Software.Main"
             xmlns:parent="clr-namespace:Software"
             mc:Ignorable="d" 
             d:DesignHeight="27" d:DesignWidth="800">
    <Grid x:Name="grid">
        <Grid.DataContext>
            <local:StatusViewModel/>
        <Grid.DataContext>
    </Grid>
</UserControl>

Class

using Software.Messengers;
using CommunityToolkit.Mvvm.Messaging;
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using static Software.Messengers.SetStatusMessage;

namespace Software.Main
{
    internal class StatusViewModel()
    {}
}

I have no clue how to solve this =/ Preferably I dont want to set the data context from the StatusView class (file).

0

There are 0 best solutions below