完成Grid示例

This commit is contained in:
zengwenjie
2025-09-30 08:21:01 +08:00
parent a023c7f6cb
commit 61117b2098
6 changed files with 246 additions and 4 deletions

View File

@@ -95,4 +95,24 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type local:MyGrid}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyGrid}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ItemsControl x:Name="PART_ChildrenContainer" ItemsSource="{TemplateBinding Children}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid x:Name="ChildrenContainer"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>