使用usercontrol创建的datagrid不会显示在Windows Phone 7中

时间:2012-11-02 10:32:12

标签: c# windows-phone-7

我需要创建一个只显示6行和0列的数据网格。我创建了一个usercontrol,其中包含带有以下

的数据网格
<sdk:DataGrid Grid.Column="1" x:Name="Customisedgrid" BorderBrush="GreenYellow"     
     BorderThickness="3" Background="Aqua" AutoGenerateColumns="False" 
     HorizontalAlignment="Left" Height="281" Margin="48,98,0,0" 
     Style="{StaticResource CustomDataGridStyle}" VerticalAlignment="Top" 
     Width="384" Itemsource ="{Binding S_BindData}"  
     CellStyle="{StaticResource DataGridCellStyle1}">

我的用户控件准备好后,我在mainpage.cs中引用它,如下所示

private void ContentPanel_Loaded(object sender, RoutedEventArgs e)
{
  //instance of my usercontrol
  CustomGrid custom = new CustomGrid();
  //added my usercontrol to a stackpanel(GridOuterPanel)
  GridOuterPanel.Children.Add(custom);
}

我的问题是,一旦我运行我的应用程序,我没有得到任何数据网格我只查看空白页...

0 个答案:

没有答案