AvaloniaUI / Avalonia.Samples

Avalonia.Samples aims to provide some minimal samples focusing on a particular issue at a time. This should help getting new users started.
https://www.avaloniaui.net
606 stars 103 forks source link

CustomDataTemplate w/UserControl does not function #82

Closed DBenS closed 4 months ago

DBenS commented 4 months ago

The Basic DataTemplate Sample - Approach 3 (Place a UserControl inside a Data Template) is not working.

Describe the bug

When set in a project called "CustomDataTemplate", I have an error on the "view" statement of the MainWindow.axaml:

Sample affected

https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/DataTemplates/BasicDataTemplateSample#approach-3-place-a-usercontrol-inside-a-datatemplate

Screenshots

image

timunie commented 4 months ago

@DBenS it works for me without any change. Did you run it from source code or from your own project? Does the sample compile and run without an error?

[!TIP] Make sure you have setup the xml-namespace at the root node. xmlns:view="using:BasicDataTemplateSample.Views"

[!NOTE] The editor needs to have a fresh build after adding a new View, otherwise it can't find it and then you get this error.

timunie commented 4 months ago

need a sample to continue