0

I have little problem.

In my WPF appliaciton i have expander

 >>some content 
          <Expander ExpandDirection="Right" Header="" Margin="341,6,-6,0" BorderBrush="{x:Null}" Foreground="Black" Canvas.ZIndex="-1">
                <StackPanel Background="#FFE2E2E2" Margin="-28,30,-4,-2" Width="175" Opacity=".8">

                        >>some content<<

                </StackPanel>
            </Expander>

        </Grid>
    </Window>

When you eject it covers the original content, its good, but content is invisibly covered if are expander is hidden too and content under it can not use.

My think is: If expander is hidden - it have z-index: -1 and normal content can use, if I eject it - expander have z-index:1 but I do not know how to do it, thank you for reply.

4
  • Hi, sorry having trouble understanding your question. Maybe a visual example of your problem would help clarify?
    – Chris W.
    Oct 31, 2014 at 14:02
  • I am try it again.. so.. on the end XAML file I have this Expander.. expander have area for show or hide stackpanel, in this area are button and few textbox and I can not click at this, because it is under expander area. I make some changes: Expander x:Name="panel" ..... Canvas.ZIndex="-1" **ButtonBase.Click="StackPanel_Click"**> expander have zindex -1, in code behind now is: private void StackPanel_Click(object sender, RoutedEventArgs e) { here must get zindex 0 for correct show } Oct 31, 2014 at 14:42
  • You should not have to use z-index for anything, it's all in how you set up your DOM, maybe share more of your xaml?
    – Chris W.
    Oct 31, 2014 at 14:52
  • Whoa, please edit your answer with this additional code instead of adding it as comments.
    – Chris W.
    Oct 31, 2014 at 15:10

1 Answer 1

0

I got it.

Stackpanel normaly have zindex -1, and tools on my window working. if i click to the stackpanel for open it, stack panel get zindex +1, if i close it (i must click to expander button again) stackpanel get zindex -1

you can see at code

public int indexx = -1;
private void StackPanel_Click(object sender, RoutedEventArgs e)
{

    if (indexx == 1)
    { 
        indexx = -1;
        Canvas.SetZIndex(panel, indexx);

    }
    else
    {
        indexx = 1;
        Canvas.SetZIndex(panel, indexx);
    }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.