我正在尝试在月光下开发应用程序。现在我正在尝试使用 DataGrid 来显示一些数据。
在一个旧的 silverlight 项目中,我以这种方式使用了 DataGrid:
<UserControl x:Class="One.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Vertical">
<TextBlock x:Name="lbl1">lblInfo1</TextBlock>
<TextBlock x:Name="lbl2">lblInfo2</TextBlock>
<TextBox x:Name="txt1">Write here</TextBox>
<Button x:Name="btn1" Content="Send" Click="btn1_Click" />
<my:DataGrid x:Name="grData"
Grid.Row="1"
Width="500" Height="250"
Margin="10"
AutoGenerateColumns="False">
<my:DataGrid.Columns>
<my:DataGridTextColumn Header="Código" />
<my:DataGridTextColumn Header="Lote" />
<my:DataGridTextColumn Header="Ciudad" />
<my:DataGridTextColumn Header="País" />
</my:DataGrid.Columns>
</my:DataGrid>
</StackPanel>
</Grid>
</UserControl>
但是如果我在我的新月光项目中使用相同的代码,我会得到一个空白页面。我一直在寻找一些例子,我发现了一个简单的例子:
这个例子是作者以与我相同的方式使用 DartaGrid。谁能解释我为什么在 VS2010 中我可以使用此代码而在 monodevelop 2.4 或 monodevelop 2.8 中我不能?