如何在WPF中自动调整网格容器的路径

时间:2018-03-05 09:26:36

标签: wpf xaml

在WPF应用程序中,文本按照屏幕截图走出它的路径。请建议我们如何根据分辨率/窗口大小自动调整它。我试图设置一些属性但没有帮助。

 <Grid Grid.Row="0" >
        <Popup x:Name="popLines"   
           PlacementTarget="{Binding ElementName=btn}"
           Placement="Relative" 
           IsOpen="False"
           Width="750"
           ScrollViewer.CanContentScroll="True"          
           AllowsTransparency="True"
           StaysOpen="False"
           PopupAnimation="Scroll"
           HorizontalAlignment="Left"
           VerticalAlignment="Top"
           HorizontalOffset="-190" VerticalOffset="0"
           ToolTip="Approval Screen Help">

            <Grid Margin="10">
                <Path Fill="LightBlue" Stretch="Fill" Stroke="LightBlue" 
                StrokeThickness="3" StrokeLineJoin="Round"
                Margin="0" Data="M130,154 L427.5,154 427.5,240.5 299.5,240.5 287.5,245.5 275.5,240.5 130,240.5 z">
                    <Path.Effect>
                        <DropShadowEffect BlurRadius="12" Color="Black" Direction="315" Opacity="0.8"/>
                    </Path.Effect>
                </Path>

                <Grid Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Top">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="10"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Button Style="{StaticResource XBtn}" Click="btn1_Click" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 
                Text="{Binding ApprovalScreenHelp}"> 

                    </TextBlock>

                </Grid>


            </Grid>
        </Popup>

    </Grid>

below is the output of above code

0 个答案:

没有答案