我正在開發一個小型的可視化設計器,我需要實現一個索引元素的函數。所有元素都有自己的可見性級別,取決於對方。我沒有爲主要元素使用ZIndex,因此它們在視覺樹中顯示。但是當它們處於集合索引模式時,所有元素都有一個帶有索引號的區域。問題是這些地區繼承了父母的zindex。我試圖設置這些區域zindex = 1000,但它沒有幫助。WPF Panel.ZIndex子元素
<ControlTemplate x:Key="IndexRegion" TargetType="ContentControl">
<Border>
<StackPanel Orientation="Horizontal">
<!--<TextBlock Text="Индекс: "></TextBlock>-->
<TextBlock Text="{Binding TabIndex}"></TextBlock>
</StackPanel>
</Border>
</ControlTemplate>
<Style x:Key="IndexRegionStyle" TargetType="ContentControl">
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="Margin" Value="1 -15 0 0"></Setter>
<Setter Property="Visibility" Value="{Binding IsTabIndexVisible, Mode=OneWay, Converter={StaticResource VisibilityOfBool}}"></Setter>
<Setter Property="Panel.ZIndex" Value="1000"></Setter>
</Style>
<DataTemplate DataType="{x:Type viewModel:WizardFormTextFieldViewModel}">
<wfSurface:DesignSurfaceItemContainer Width="{Binding Width}" Height="{Binding Height}" ClipToBounds="False">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<ContentControl Style="{StaticResource IndexRegionStyle}" Template="{StaticResource IndexRegion}">
</ContentControl> --- this is an index region
<Border Style="{StaticResource WrongElement}">
<Border Style="{StaticResource TextFieldStyle}">
</Border>
</Border>
</Grid>
</wfSurface:DesignSurfaceItemContainer>
</DataTemplate>
我該如何讓所有區域都超過所有主要元素?
謝謝!
請組織代碼。你可以通過在行的開始處按4個空格來做到這一點 – om471987
是的,我剛剛做到了。 –