Siverlight Grid XAML 스크립트 문제
-
06-07-2019 - |
문제
다음은 Siverlight 그리드 스크립트입니다. 미디어 요소 미디어 플레이어가 전체 그리드 공간의 왼쪽 절반을 차지하고 미디어 요소 Cameraplayer가 전체 그리드 공간의 오른쪽 절반을 차지하기를 원합니다. 그러나 다음 코드는 잘 작동하지 않습니다 (관련 그리드 열/행 값을 설정했습니다).
어떤 아이디어가 잘못 되었습니까?
<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>
미리 감사드립니다, 조지
해결책
그리드에서 열 정의를 정의해야합니다.
<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>
열이 원하는 너비를 지정해야합니다.
제휴하지 않습니다 StackOverflow