1
如何設置UserControl的ZIndex? 我試圖Silverlight設置UserControl的ZIndex
Canvas.SetZIndex((Tile)sender, 99);
((Tile)sender).SetValue(Canvas.ZIndexProperty, 99);
瓷磚是我有一個矩形,它是實際出現在屏幕上的用戶控件內我的用戶 的名稱。 我也曾嘗試
編輯:
這裏是爲我的用戶
<UserControl x:Class="Carcassonne.Tile"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="76" d:DesignWidth="76">
<Canvas x:Name="LayoutRoot" Background="Transparent">
<Rectangle x:Name="rect"
Width="76" Height="76"
HorizontalAlignment="Left">
<Rectangle.Fill>
<ImageBrush x:Name="tileImage">
<ImageBrush.RelativeTransform>
<RotateTransform x:Name="rotation" CenterX="0.5" CenterY="0.5" Angle="0" />
</ImageBrush.RelativeTransform>
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
</Canvas>
</UserControl>
您是否位於Canvas面板內的用戶控件?相對於你想要設置zIndex的是什麼?換句話說,你能提供你的標記的XAML代碼嗎? – 2011-02-02 20:13:48
@Pavlo Glazkov是用戶控件位於「畫布」面板中。我有很多用戶控件,我需要將它們的Z-Index設置爲相對於主畫布或相互之間的關係。請在我的開場白中看到我的編輯。 – Arizona1911 2011-02-02 20:59:54