d:Text property does not exist in namespace http://schemas.microsoft.com/expression/blend/2008

Carolina Gritti 41 Reputation points
2021-09-01T08:23:21.193+00:00

Hi,

i'm working on a WPF application on Visual Studio 2019 version 16.8.3.
I need to use design time data.
I followed what is written in this article
https://learn.microsoft.com/en-us/visualstudio/xaml-tools/xaml-designtime-data?view=vs-2019

But when i try to add a TextBlock in this way

<TextBlock Text="{Binding Name}" d:Text="Name!" />

designer says that "Text property does not exist in namespace http://schemas.microsoft.com/expression/blend/2008"

Any suggestions?
Thanks!

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,676 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
766 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.5K Reputation points
    2021-09-01T08:37:03.69+00:00

    It seems that the feature is available in .NET Core and .NET 5 projects. Try experimenting with a new “WPF Application” instead of “WPF App (.NET Framework)”.

    In case of .NET Framework, try enabling an option: menu, Tools, Options, Environment, Preview Features, “New WPF XAML Designer…”. Then restart Visual Studio.

    Make sure the the <Window> contains the definitions of xmlns:d and xmlns:mc, which usually are already present by default.

    Also consider updating Visual Studio.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Carolina Gritti 41 Reputation points
    2021-09-01T13:00:43.873+00:00

    Thank you very much!

    First i tried with a new “WPF Application” (not “WPF App (.NET Framework)”) and it works!

    But then i updated Visual Studio and enabled the option “New WPF XAML Designer…” and it works also with a WPF App (.NET Framework) application.

    0 comments No comments