1
我有3件事情我想在某些東西里包裝起來,這樣我就可以從代碼中調用容器,而不是分別調用每個東西。Silverlight - 一堆元素的基本容器
我可以看到有一個Canvas
容器,但沒有更通用的東西,只是作爲一個包,我可以打電話?
這裏是我當前的代碼:
<Rectangle Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Fill="Black" Width="420" Height="480" Opacity=".5"></Rectangle>
<Rectangle Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Fill="Black" Width="100" Height="50" VerticalAlignment="Top" Margin="0,50,0,0" RadiusX="5" RadiusY="5"></Rectangle>
<TextBlock Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Foreground="White" Text="Loading" HorizontalAlignment="Center" Margin="0,65,0,0"></TextBlock>
我希望我能做到這一點:
<Container>
<Rectangle Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Fill="Black" Width="420" Height="480" Opacity=".5"></Rectangle>
<Rectangle Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Fill="Black" Width="100" Height="50" VerticalAlignment="Top" Margin="0,50,0,0" RadiusX="5" RadiusY="5"></Rectangle>
<TextBlock Grid.Column="0" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="3" Foreground="White" Text="Loading" HorizontalAlignment="Center" Margin="0,65,0,0"></TextBlock>
</Container>
BTW,這應該是這個樣子:
---------------
| --------- |
| | Loading | |
| --------- |
| |
| |
| |
| |
---------------
謝謝,
Aaron