简体   繁体   中英

UWP XAML designer not showing up layout items

I followed a tutorial (Microsoft's "Getting started with Windows Template Studio") for creating a example UWP app using Windows Template Studio for Windows Desktop. They usually ask questions like : "The XAML Editor doesn't open, doesn't shown etc." but I have a slightly different situation : XAML designer not showing layout items. It's completely black or white. But their alignments, locations, sizes etc. is showing correctly. I'm changing theme settings but it doesn't work.

黑色

白色

Running state :

跑步

Everything seems and normal, when I Compile & Run the project.

EDIT: Everything is still black.

  • Project's Target Version : Fall Creators Update
  • Windows Template Studio : v1.6.17355.2
  • Visual Studio : v17, v15.5.2
  • Windows 10 : v1709, b16299.192

If you want to show data at design-time, you would need to Create Sample Data from Class feature in Blend for Visual Studio. You need to specify the d:DataContext and d:DesignData , then you could use Binding to show data in your control.

Please note that:

You can even set both d:DataContext and DataContext in markup if you like. d:DataContext will override at design-time, and DataContext will override at run-time. These same override rules apply to all design-time and run-time attributes.

Please read "Sample data from class", and design-time attributes for more details.

The Windows Template Studio for UWP templates come wired-up with localization in place, meaning that the text that you'd normally expect to see in the design window for an application is not there.

The answer to your question is found in the Strings/en-us/Resources.resw file in the project. Opening up the file shows a number of entries in it, one of which is for the Settings_Theme_Dark id as specified in the x:Uid="Settings_Theme_Dark" of the RadioButton in your screenshot...

Resources.resw

The .Content on the end of the Id specifies the property on the RadioButton into which the resource value should be placed. So the Content property of the RadioButton becomes "Dark" at runtime when your local resource is en-us (or it falls back to this when no other language is set).

To support additional languages, you can add more Resource.resw files each with content for specific languages.

To find out more about this feature of UWP, please see Microsoft Docs for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM