问一个简单的问题,关于xaml控件属性格式的问题
<Button Click="BTN_LOGIN_Click">
<Button.Name>BTN_LOGIN</Button.Name>
<Grid.Row>3</Grid.Row>
<Grid.Column>1</Grid.Column>
<Button.Content>登录</Button.Content>
</Button>
这样写BUTTON空间时,编译后会报错,“警告1从未对字段“WpfApplication1.MainWindow.BTN_LOGIN”赋值,字段将一直保持其默认值 nullD:\Projects\WpfApplication1\WpfApplication1\MainWindow.xaml2049WpfApplication1
”
但我将name字段移到上面就能够正常运行
<Button Name="BTN_LOGIN" Click="BTN_LOGIN_Click">
<Grid.Row>3</Grid.Row>
<Grid.Column>1</Grid.Column>
<Button.Content>登录</Button.Content>
</Button>
是NAME属性必须写在上面吗? 控件 BUTTON XAML
[解决办法]
我在VS2012里面,可以编译通过的。