Solitaire icon indicating copy to clipboard operation
Solitaire copied to clipboard

ResourceDictionaries can't be previewed without Desgin.PreviewWith

Open MikeyWetzel opened this issue 11 months ago • 1 comments

I'm looking at the Solitaire example to learn Avalonia and the above error is throwing me off.

Can you add the necessary <Design.PreviewWith> to all the items in the Styles directory? For example, ButtonCard.axaml:

<Design.PreviewWith>
	<Border Padding="20" Background="Gray">
		<Button Content="Button" />
	</Border>
</Design.PreviewWith>

MikeyWetzel avatar Jan 13 '25 16:01 MikeyWetzel

As an alternate approach, I suggest adding DevTools to the main Solitaire project via:

<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />

Run Solitaire.Desktop in debug mode and press F12 to launch. See the Developer Tools docs for details. This will help identify visual components, especially in the Visual Tree tab. Personally, I almost never use the previewer, but I can see why learners would want it.

stevemonaco avatar Jan 14 '25 07:01 stevemonaco