G
G
Georgy Kuznetsov2021-07-11 20:13:36
C++ / C#
Georgy Kuznetsov, 2021-07-11 20:13:36

Why doesn't xaml see the class in the namespace?

Let's say there is such xaml code with an error in the windows.datacontext block

<Window x:Class="TestProject.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TestProject"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.DataContext>
        <!-- ошибка здесь -->
        <local:MainWindowClass/> 
    </Window.DataContext>
    <Grid>

    </Grid>
</Window>


And the C# code we are trying to refer to in order to bind the values ​​of some properties to the elements

namespace TestProject
{
    class MainWindowClass
    {

    }
}


Question: what's wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question