【解決方法】WPFでタブコントロールをレスポンシブするには?


What I want to do is that when I maximize the WPF window the TabControl should also be responsive with the WPF window. But in the following code the TabControl does not become responsive

私が試したこと:

this my Xaml code:-

XML
<Grid RenderTransformOrigin="0.5,0.5" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        

        <StackPanel x:Name="viewerPanel" Background="#b3b3b3" Grid.Row="1" Grid.Column="1" Margin="1,5.2,1,5">
            <TabControl x:Name="viewtab" Margin="3,3,2.6,2" Height="554" Background="#b3b3b3" BorderBrush="#FF123648" BorderThickness="2">
                <TabItem Header="3D View" Margin="0,-2,-11.8,-0.2">
                    <helix:HelixViewport3D x:Name="viewPort3d" IsViewCubeEdgeClicksEnabled="True" ShowCoordinateSystem="True" RenderTransformOrigin="0.487,0.498" MouseUp="viewPort3d_MouseUp">
                        <helix:HelixViewport3D.DefaultCamera>
                            <PerspectiveCamera FieldOfView="61" NearPlaneDistance="0.001" Position="10,10,10" LookDirection="0,0,-1" UpDirection="0,1,0" />
                        </helix:HelixViewport3D.DefaultCamera>
                        <helix:SunLight/>
                        <!--<helix:GridLinesVisual3D/>-->
                        <helix:BoundingBoxVisual3D  BoundingBox="{Binding SelectedObject, Converter={StaticResource BoundsConverter}}" Diameter="0.2"/>
                    </helix:HelixViewport3D>
                </TabItem>
        </StackPanel>

解決策 1

次のような固定サイズは使用しないでください。

XML
Height="554"

TabControl が親コンテナーのコンテンツ領域に収まるようにします。

コメント

タイトルとURLをコピーしました