c# - Change z order of image controls at runtime windows phone -


i have several image controls placed on canvas. want change z order of selected image control when user click on app bar button.

in image control class have

    public int imagezorder      {                  {             return _imagezorder;                     }         set          {             _imagezorder = value;             canvas.setzindex(imagecontrol, _imagezorder);         }      } 

and in app bar

    private void appbarfront_click(object sender, eventargs e)     {         currentcharobject.imagezorder += 1;     } 

i expecting see selected image brought front of other image controls immediately. above code not work. missing something. have redraw image controls on canvas new z order value?

update 1

in xaml have following. each image added children cvsnote

    <grid x:name="gridcanvas" grid.row="0">         <canvas x:name="cvsnote" />     </grid> 

update 2 want add 'image control' contains in particular class 1 of class many properties.

you can change zindex in code.

assuming xaml:

<canvas grid.row="1" tap="gridtapped">     <image x:name="imga" source="assets/a.png" />     <image x:name="imgb" source="assets/b.png" />     <image x:name="imgc" source="assets/c.png" /> </canvas> 

you change image on top following:

private int topzindex = 10;  private void gridtapped(object sender, gestureeventargs e) {     var rand = new random();     switch (rand.next(0, 3))     {         case 0:             canvas.setzindex(this.imga, ++topzindex);             break;         case 1:             canvas.setzindex(this.imgb, ++topzindex);             break;         case 2:             canvas.setzindex(this.imgc, ++topzindex);             break;     } } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -