您的位置:首页 > 编程语言

(WPF)XAML 过程式代码

2015-07-27 07:34 197 查看
当代码编译,x:Code 元素的内容将被放到.g.cs文件。

<Window x:Class="WpfApplication7.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Background="{x:Null}"
Height="32"
x:Name="Btn"
Click="Btn_Click"
Width="{x:Static SystemParameters.IconWidth}"
Content="{Binding Path=Width,RelativeSource={RelativeSource Self}}"
>
</Button>
<x:Code>
<![CDATA[
void Btn_Click(object sender,RoutedEventArgs e)
{
this.Close();
}
]]>
</x:Code>
</Grid>
</Window>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: