locked
Set zindex with c#? RRS feed

  • Question

  • Already did a search. SetZIndex does not work with winrt. Is it possible for me to set the zindex property with c#?
    Wednesday, February 5, 2014 7:33 AM

Answers

  • you can use,, its an attached property
    Windows.UI.Xaml.Controls.Canvas.SetZIndex(Yourcontrol, 1);


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#


    Wednesday, February 5, 2014 8:18 AM
  • ZIndex is a Canvas property to control the contents of the Canvas. It will work on any controls contained in a Canvas. It isn't supported outside of a Canvas.

    For your use I'd highly recommend rendering only the visible page. Having a large amount of overdraw from pages drawing and then being covered up can cause significant performance problems. See Optimize loading XAML .

    --Rob

    Wednesday, February 5, 2014 8:57 PM
    Moderator

All replies

  • you can use,, its an attached property
    Windows.UI.Xaml.Controls.Canvas.SetZIndex(Yourcontrol, 1);


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#


    Wednesday, February 5, 2014 8:18 AM
  • Thank you for your answer.  Will this command work for usercontrol or will it only work for canvas?  I am trying to simulate tab control.  Before I was rendering all the pages invisible but it's a mess to print, so putting the selected page in front should work better.
    Wednesday, February 5, 2014 4:12 PM
  • Works for usercontrol as well

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, February 5, 2014 4:52 PM
  • ZIndex is a Canvas property to control the contents of the Canvas. It will work on any controls contained in a Canvas. It isn't supported outside of a Canvas.

    For your use I'd highly recommend rendering only the visible page. Having a large amount of overdraw from pages drawing and then being covered up can cause significant performance problems. See Optimize loading XAML .

    --Rob

    Wednesday, February 5, 2014 8:57 PM
    Moderator