Add support for d:DesignInstance when using d:DataContext in designer
See original GitHub issueError:
Cannot create unknown type '{http://schemas.microsoft.com/expression/blend/2008}DesignInstance'.
Repro:
<UserControl x:Class="Draw2D.Views.MainView"
xmlns="https://github.com/avaloniaui"
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:editor="clr-namespace:Draw2D.Editor"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=editor:CanvasEditor, IsDesignTimeCreatable=True}"
d:DesignWidth="800" d:DesignHeight="600">
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Binding data context to view using DesignInstance
Binding data context to view using DesignInstance · 1. Try to use d:DataContext="{d:DesignInstance ViewModels:VM1}". – Pavel Anikhouski. Feb 10, ...
Read more >Sample data on the design surface, and for prototyping
In the Properties window, find the DataContext property (inside the Common category), and modify it. Select your view model type from the Select ......
Read more >XAML Intellisense fails to populate with values from a ...
XAML Intellisense fails to populate with values from a DataContext declared using d:DesignInstance after a project is built/run.
Read more >How to use d:DataContext and dxmvvm:ViewModelSource
In the designer, this displays the warning "Cannot resolve property 'ToolTip' in data context of type 'object'. So I define d:DataContext: C#. < ......
Read more >Usable WPF Design-Time Data for .NET 5.0 (and 6.0)
I find design-time support essential for successful WPF view design, ... I could see us making using of d:DesignInstance is either by adding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Docs have moved to https://docs.avaloniaui.net/docs/getting-started/ide-support#design-time-properties FYI
For those who came across this issue while looking for a way to set a design-time
DataContext
. In Avalonia, this works as easy as:See also: https://avaloniaui.net/docs/quickstart/vs-designer#design-time-properties
Should be quite easy to add support for
d:DesignInstance
, we just need to write a customIXamlAstTransformer
I guess.