【问题标题】:Siverlight Grid XAML script issueSilverlight Grid XAML 脚本问题
【发布时间】:2010-04-08 20:30:04
【问题描述】:

这是我的 Siverlight Grid 脚本,我希望 Media Element mediaPlayer 占据整个 Grid 空间的左半部分,并希望 Media Element cameraPlayer 占据整个 Grid 空间的右半部分。但是我下面的代码效果不太好(我已经设置了相关的Grid列/行值),两个Media Elements播放重叠。

有什么想法吗?

<Grid x:Name="LayoutRoot2" Margin="0" Background="#FF0D0A0A" Cursor="Hand" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <MediaElement HorizontalAlignment="Stretch" Margin="10,10,10,10" x:Name="mediaPlayer" AutoPlay="false" Grid.Column="0" Grid.Row="0"/>
    <MediaElement HorizontalAlignment="Stretch" x:Name="cameraPlayer" AutoPlay="false" Grid.Column="1" Grid.Row="0"/>
</Grid>

提前致谢, 乔治

【问题讨论】:

    标签: c# .net silverlight xaml grid


    【解决方案1】:

    您需要在网格上定义列定义。

    <Grid x:Name="LayoutRoot2" Margin="0" Background="#FF0D0A0A" Cursor="Hand" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.ColumnDefinitions>
             <ColumnDefinition
                    Width="specify width" />
             <ColumnDefinition
                    Width="specify width" />
        </Grid.ColumnDefinitions>
        <MediaElement HorizontalAlignment="Stretch" Margin="10,10,10,10" x:Name="mediaPlayer" AutoPlay="false" Grid.Column="0" Grid.Row="0"/>
        <MediaElement HorizontalAlignment="Stretch" x:Name="cameraPlayer" AutoPlay="false" Grid.Column="1" Grid.Row="0"/>
    </Grid>
    

    您需要指定您希望列的宽度。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多