c# - XAML - Changing the background image deletes the textbox -
i making windows 8 universal app. in order make hover effect, want change background image of stackpanel. stackpanel contains textblock, disappears change background image.
here c#
//creating background image var brush = new imagebrush(); brush.imagesource = new bitmapimage(new uri("ms-appx:/assets/newprojectblue.png")); //adding background panel panel.background = brush; //changing color of text paneltext.foreground = new solidcolorbrush(windows.ui.color.fromargb(1, 255, 255, 255));
and here xaml
<stackpanel x:name="panel" horizontalalignment="left" height="90" margin="177,250,0,0" verticalalignment="top" width="355" background="#ffebeffe" rendertransformorigin="0.5,0.5" pointerentered="panel_pointerentered" pointerexited="panel_pointerexited"> <textblock x:name="paneltext" textwrapping="wrap" text="textblock" horizontalalignment="right" margin="158,0,31,0" height="63" fontsize="30" width="166" verticalalignment="center" foreground="#ff4183d7" canvas.zindex="1000" /> </stackpanel>
i don't think z index error.
you setting alpha 1
, very transparent (invisible). if thinking it's in range [0.0;1.0]
, wrong, it's in range [0;255]
:
// wrong fromargb(1, 255, 255, 255) // correct fromargb(255, 255, 255, 255)
Comments
Post a Comment