当我尝试打开我的一些 xaml 文件的设计器时,我在一个简单的消息弹出窗口中收到以下消息:
“价值不在预期范围内”
我试图创建一个新窗口并在记事本中打开 xaml 文件并将它们复制到新窗口中,但即使使用新控件,它也会给我这个错误,甚至没有修改它。
这是给我一个错误的xamls之一:
<controls:ChildWindow x:Class="Playground.Views.MessageWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Width="343" Height="159"
Title="MessageWindow" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="316*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="216*" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,9,0,0" Grid.Row="1" Grid.ColumnSpan="2" />
<dxe:TextEdit HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" Name="txtMessage" IsReadOnly="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Background="#FFE7E9EC" />
</Grid>
这是一个没有这个问题的:
<controls:ChildWindow x:Class="Playground.Views.LogIn"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Width="270" Height="200"
Title="Log In" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
<Button x:Name="OKButton" Content="Log In" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
<sdk:Label Height="23" HorizontalAlignment="Left" Margin="18,23,0,0" Name="label1" VerticalAlignment="Top" Width="60" Content="Username" />
<sdk:Label Height="23" HorizontalAlignment="Left" Margin="18,56,0,0" Name="label2" VerticalAlignment="Top" Width="60" Content="Password" />
<dxe:CheckEdit HorizontalAlignment="Left" Margin="18,85,0,0" Name="checkEdit1" VerticalAlignment="Top" Width="92" Content="Use CIL/CIP" IsThreeState="False" Checked="checkEdit1_Checked" Unchecked="checkEdit1_Unchecked"/>
<dxe:CheckEdit Margin="116,85,0,0" Name="remUNCE" VerticalAlignment="Top" Content="Save Username" IsThreeState="False" HorizontalAlignment="Left" Width="120" Checked="remUNCE_Checked" Unchecked="remUNCE_Unchecked"/>
<dxe:TextEdit HorizontalAlignment="Left" Margin="86,23,0,0" Name="textEdit1" VerticalAlignment="Top" Width="136" Text="administrator" />
<dxe:PasswordBoxEdit HorizontalAlignment="Left" Margin="86,56,0,0" Name="passwordBoxEdit1" VerticalAlignment="Top" Width="136" />
</Grid>
我尝试在互联网上搜索这个问题,但我得到的只是同一个 xaml 中重复名称的结果,这里不是这种情况,我也没有在代码隐藏中注入任何控件,所以关于重复不应该有任何问题名字。我使用visual studio 2010,如果它有任何相关性,我已经安装了devexpress,但是当我开始收到这个错误时,我有一个早期版本,所以我将它升级到最新版本,希望能修复它,但没有运气。