LayoutInformation 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義方法,以提供專案配置的其他資訊。
public ref class LayoutInformation sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LayoutInformation final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LayoutInformation
Public NotInheritable Class LayoutInformation
- 繼承
- 屬性
範例
下列範例示範如何使用 GetLayoutSlot 並繪製 Rectangle 的周框方 塊。
<StackPanel x:Name="sp1" Grid.Row="0" Background="LightBlue"
Height="100" Width="200"
HorizontalAlignment="Left" VerticalAlignment="Top" >
<Rectangle x:Name="rect1" Fill="Blue" Width="100" Height="50" ></Rectangle>
</StackPanel>
<Button Content="Get Layout Slot"
Grid.Row="1" Width="150" Height="50"
Click="Button_Click" HorizontalAlignment="Left"/>
private void Button_Click(object sender, RoutedEventArgs e)
{
//Get Layout Slot of Rectangle
Windows.Foundation.Rect r1 = LayoutInformation.GetLayoutSlot(rect1);
RectangleGeometry rg1 = new RectangleGeometry();
rg1.Rect = r1;
Path mypath = new Path();
mypath.Data = rg1;
mypath.Stroke = new SolidColorBrush(Colors.Red);
mypath.StrokeThickness = 4;
LayoutRoot.Children.Add(mypath);
}
方法
GetAvailableSize(UIElement) |
傳回最近用來測量指定元素的 Size 值。 |
GetLayoutExceptionElement(Object) |
傳回在未處理例外狀況時,配置系統正在處理的專案。 |
GetLayoutSlot(FrameworkElement) |
傳回包含指定專案的版面配置位置或周框方塊。 |