WPF-弹出窗口中的数据网格不显示其内容

WPF-弹出窗口中的数据网格不显示其内容,wpf,datagrid,popup,Wpf,Datagrid,Popup,我有一个包含数据网格的弹出窗口。如果我将数据网格划分为列,那么它将显示数据网格中的列,并且没有问题。但是当我在数据网格的行中包含一些内容时,这些内容就不可见了 <Popup Name="myPopUp" Placement="MousePoint" AllowsTransparency="False" PopupAnimation="Slide" StaysOpen="False"

我有一个包含数据网格的弹出窗口。如果我将数据网格划分为列,那么它将显示数据网格中的列,并且没有问题。但是当我在数据网格的行中包含一些内容时,这些内容就不可见了

<Popup  Name="myPopUp"
            Placement="MousePoint"
            AllowsTransparency="False" 
            PopupAnimation="Slide" 
            StaysOpen="False" 
            Height="370"
            Width="350">

          <Border BorderThickness="3" BorderBrush="Black">
            <Grid Background="White">
                <Grid.RowDefinitions>
                    <RowDefinition Height="320"/>
                    <RowDefinition Height="40"/>
                </Grid.RowDefinitions>
                <DataGrid>
                <DataGrid.Columns>

                     <DataGridTemplateColumn Header="Code" Width="160" IsReadOnly="True">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="Test"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                     </DataGridTemplateColumn>
                </DataGrid.Columns>
                </DataGrid>
             </Grid>
           </Border>
</Popup>

我想知道为什么会这样。有人能帮忙吗?
是否在弹出窗口中不能包含数据网格?

要使弹出控件可见,需要将IsOpen属性设置为true。
作为参考,

如果您直接在DataGrid中添加类似控件的按钮,它会显示。你可以试试。现在,如何将ItemSource添加到DataGrid?