MageshSankar-5062 avatar image
2 Votes"
MageshSankar-5062 asked DaisyTian-1203 commented

Custom Control edit template cause compilation failure in Visual Studio 2019 (version 16.7 Preview 2)

In Visual Studio 2019 version 16.7 Preview 2, while try to edit the template of my custom control using Edit Template option in designer which causes compilation failure due to empty properties fields generated. Please find the code genereate details.

Code in our source side

<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="HorizontalContentAlignment" Value="{x:Static HorizontalAlignment.Center}" />

Code generated while edit template

<Setter Property="FocusVisualStyle">

<Setter Property="HorizontalContentAlignment">

The issue reproduce only in Preview version and it working fine previous version.

Project Framework : 4.6v

Error : Severity Code Description Project File Line Suppression State
Error The tag 'Static' does not exist in XML namespace ''. Line 85 Position 22. ControlTesting MainWindow.xaml 85

Please suggest any solution to fix this.


· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm also facing same problem. I've created simple custom library and custom control to demonstrate the issue.


In additional am facing, that the AutomationProperty name is replaced with x:Name of the control while generating template.

Style will be generated properly if the control source has been attached to the application.

0 Votes 0 ·

I can't reproduce your issue in my Visual Studio 16.7 preview 2 with .framework4.6. Here is my option for generating code in edit template. Did I miss some option for your issue?

and the result image is:


0 Votes 0 ·
1.png (37.4 KiB)
2.png (92.7 KiB)

@DaisyTian-MSFT check once did you enabled preview features in you Visual STudio


0 Votes 0 ·
preview.png (130 B)

@DaisyTian-MSFT Check once , whether you enabled preview features options in your Visual Studio. The reported issue reproduce only you enabled preview features


0 Votes 0 ·
preview.png (588.3 KiB)

I still can't reproduce the issue with it checked, could you show me the detailed steps to reproduce the issue?

0 Votes 0 ·

@DaisyTian-MSFT , attached reproduce sample in my post. Can you check that?

0 Votes 0 ·

I'm also facing this issue. Additionally, i'm facing the issue the attached properties are not generated when copying the template. For example, It generates <setter value="false"/> instead of <setter property="Stylus.IsFlicksEnabled" value="false"/>.

0 Votes 0 ·

1 Answer

LeonLaude avatar image
0 Votes"
LeonLaude answered


Visual Studio is currently not supported in the Q&A forums, the supported products are listed over here (more to be added later on).

You can ask the experts in the dedicated Visual Studio forum over here:

(Please don't forget to accept helpful replies as answer)

Best regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.