简体   繁体   English

为什么Visual Studio会在我的所有控件中添加“ p:”?

[英]Why does visual studio add “p:” to all my controls?

I've noticed that if I add a control by dragging it from the toolbox, the letter p, followed by a colon, is appended to the beginning of the control name, and also some of it's properties. 我注意到,如果我通过从工具箱中拖动控件来添加控件,则在控件名称及其某些属性的开头会附加字母p和冒号。 The "XAML Styler" extension also seems to do the same when you format. 格式化时,“ XAML Styler”扩展名似乎也做同样的事情。

I've noticed that everything (at least seems to) have the same exact behavior if you take off all the p's. 我注意到,如果取消所有p,则所有事物(至少似乎)具有相同的确切行为。

Is there any benefit to having, say 说有什么好处

<p:Rectangle
    x:Name="leftPanel"
    Grid.Row="1"
    Fill="#FF2F3136" />

rather than 而不是

<Rectangle
    x:Name="leftPanel"
    Grid.Row="1"
    Fill="#FF2F3136" />

It is just adding the reference to the namespace which would be defined at the top of the XAML document, like for example here: 它只是添加对将在XAML文档顶部定义的名称空间的引用 ,例如此处:

<Page x:Class="WPFApplication1.MainPage"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:custom="clr-namespace:SDKSample;assembly=SDKSampleLibrary">  
  ...  
  <custom:ExampleClass/>  
...  
</Page> 

You should probably find a reference to System.Windows.Shapes defined in the namespaces at the top of your document 您可能应该找到对文档顶部名称空间中定义的System.Windows.Shapes的引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么Visual Studio向我的命名空间添加一个at符号(@)? - Why does Visual Studio add an at sign (@) to my namespace? 为什么 visual studio 将所有新类标记为<compile Remove />在我的 csproj 文件中? - Why does visual studio mark all new classes as <Compile Remove /> in my csproj file? Visual Studio名称控件如何? - How does Visual Studio name controls? 为什么我在Visual Studio中的对象浏览器中找不到System.Windows.Controls命名空间? - Why don't I find the System.Windows.Controls namespace in my object browser in Visual Studio? 为什么我所有的 Visual Studio 测试结果都“未执行” - Why are all my Visual Studio test results "Not executed" 为什么Visual Studio需要很长时间才能添加项目或文件 - Why does Visual Studio take so long to add a project or file 为什么Visual Studio会添加不同版本的引用? - Why does Visual Studio add reference with different version? 为什么 Visual Studio 会在生成的 hash 代码计算中添加“-1937169414”? - Why does Visual Studio add “-1937169414” to a generated hash code computation? 为什么 Visual Studio 2012 找不到我的测试? - Why does visual studio 2012 not find my tests? 为什么Visual Studio说我的输入字符串格式不正确? - Why does Visual Studio say my input string is not in a correct format?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM