C#操作导出xml的问题
我在WPF中导出控件的XAML代码,用的是XElement元素,现在的问题是导出的xaml里,根元素除外,其它的节点,只要不是叶子节点,或者说只要节点里面还包含了其它的节点,都会多出来一个xmlns="",不知道什么原因,求指教。
<UserControl xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Grid Width="147.00000000000003" Background="#FF808080" Height="200.00000000000003" xmlns=""> <Button Canvas.Left="27" Canvas.Top="54" Panel.ZIndex="1" Width="65" Height="65" Content="按钮" /> </Grid></UserControl>