0
我在ScrollViewer和TextBlock周圍製作了一個邊框,但是它們的邊角略微延伸到了我的邊框的圓角。我怎樣才能讓它走向另一個方向呢?
我試過使用Panel.ZIndex但它沒有工作。
這裏是我的代碼:如何在WPF內容的頂部顯示邊框?
<Window x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Behaviors="clr-namespace:UI.Behaviors;assembly=UI.Behaviors"
Title="My app" Height="408" Width="523" Closed="Window_Closed" Visibility="Visible"
Behaviors:FocusBehavior.FocusFirst="True" Closing="Window_Closing">
<Grid>
<Border
HorizontalAlignment="Stretch"
Panel.ZIndex="3"
BorderThickness="4"
CornerRadius="10"
BorderBrush="Black" Grid.ColumnSpan="2" Margin="12,50,8,48">
<ScrollViewer Panel.ZIndex="2" Name="ScrollViewer1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ClipToBounds="True" >
<TextBlock Background="WhiteSmoke" Panel.ZIndex="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" Name="textBlock1" Text="" />
</ScrollViewer>
</Border>
</grid>
</Window>
謝謝修復它。 – user1509229