FrameworkElement.Name problem

后端 未结 2 908
天命终不由人
天命终不由人 2021-01-17 23:38

I am attempting to set the Name property of a Page in the constructor:

public partial class PageListView : Page
{
    public PageListView(string title)
    {         


        
2条回答
  •  清酒与你
    2021-01-18 00:05

    The Name property generally follows the rules of C#/VB.NET identifiers (i.e. fields). Based on the documentation:

    The string values used for Name have some restrictions, as imposed by the underlying x:Name Directive defined by the XAML specification. Most notably, a Name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores.

    Based on the parameter you are passing (i.e. title), it seems like you may violate that. But you'd have to give some specific examples to be sure.

提交回复
热议问题