0

希望知道如何解决这个问题:我在 Initialize Component() 处收到此异常:我认为问题出在 XAML 代码中的网格中,有什么想法吗?

System.Windows.Markup.XamlParseException 发生 Message=“System.Windows.Controls.Border.Child”属性设置了多次。StackTrace:在 Minimal.MainPage.InitializeComponent() 在 Minimal.MainPage..ctor() 的 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) InnerException:

            <basics:GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />

            <Grid Margin="5" Grid.Column="2" Background="White" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" Margin="2" Orientation="Horizontal">
                    <TextBox Name="SearchTextBox" Text="JOHN" VerticalAlignment="Center" Width="100"
                     HorizontalAlignment="Left" Margin="2,2,5,2" />
                    <Button Content="Search by owner name" Click="Button_Click" 
                    Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right" />
                </StackPanel>
                <ScrollViewer Grid.Row="1">
                    <esri:FeatureDataGrid x:Name="MyDataGrid"
            Map="{Binding ElementName=MyMap}" 
            GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[MontgomeryParcels]}" />
                </ScrollViewer>
            </Grid>

        </Border>

    </userControls:DraggableWindow>
4

2 回答 2

1

由于我们只能看到一个边框的结束标签,并且我看到您在该边框(您的GridSplitter和您的Grid)中塞满了多件东西我会说没有看到整个片段您需要为该边框中的所有对象提供一个父容器而且你会很高兴,因为 Border 只接受一个孩子。

例如,而不是;

<Border>
    <Object/>
    <Object/>
    <Object/>
</Border>

你需要更多类似的东西;

<Border>
    <ContentContainer><!-- Grid, or StackPanel, or whatever you choose -->
        <Object/>
        <Object/>
        <OBject/>
    </ContentContainer>
</Border>
于 2013-01-05T20:34:51.157 回答
0

I fixed the problem-removed code from grid inside draggable window to main project grid. It is now a menu item.

于 2013-01-06T21:29:14.720 回答