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!

Developer technologies | Windows Presentation Foundation
Developer technologies | XAML
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.