xaml - WinRT How to make Logout appbar style? -


i want have logout icon in appbar. sure should in common styles, discovered unfortunately it's not.

so, how can it?

i've found this site, found icon wanted logout button, , copied xaml gave me path. next added code common:

<style x:key="logoutappbarbuttonstyle" targettype="buttonbase" basedon="{staticresource appbarbuttonstyle}">     <setter property="automationproperties.automationid" value="logoutappbarbutton" />     <setter property="automationproperties.name" value="logout" />     <setter property="contenttemplate">         <setter.value>             <datatemplate>                 <grid>                     <viewbox rendertransformorigin="0.47,0.47">                         <viewbox.rendertransform>                             <transformgroup>                                 <compositetransform rotation="0" scalex="0.551720260135184" scaley="0.551720260135184" />                             </transformgroup>                         </viewbox.rendertransform>                         <path stretch="uniform"                               fill="{binding path=foreground, relativesource={relativesource mode=templatedparent}}"                               data="f1 m 0,71.4297c -0.0207825,54.2669 7.09511,41.2825 13.974,33.0403c 20.8893,24.7292 27.6055,20.7252 28.2083,20.3522c 32.6992,17.6946 38.4714,19.2199 41.0976,23.7583c 43.7188,28.2812 42.2317,34.0878 37.7787,36.7583l 37.7604,36.7707l 37.7044,36.8053l 37.2148,37.1308l 35.1185,38.6797c 33.3203,40.1106 30.849,42.3333 28.414,45.2734c 23.5221,51.2292 18.8593,59.6705 18.8385,71.427c 18.8424,83.2799 23.5678,93.9374 31.2579,101.724c 38.9648,109.497 49.5065,114.279 61.2304,114.281c 72.9544,114.279 83.4961,109.497 91.2019,101.724c 98.8932,93.9374 103.619,83.2799 103.622,71.427c 103.602,60.0305 99.2304,51.7707 94.5065,45.8346c 90.0091,40.207 85.1979,37.0722 84.7188,36.7799l 84.7031,36.7721l 84.6888,36.7642l 84.6784,36.7597c 80.2304,34.0865 78.7435,28.2799 81.362,23.7571c 83.9909,19.2187 89.7618,17.6933 94.2514,20.3509c 94.8568,20.7226 101.573,24.7265 108.488,33.0384c 115.371,41.2825 122.483,54.2655 122.464,71.427c 122.457,105.611 95.0443,133.322 61.2317,133.333c 27.4205,133.322 0.00785828,105.611 0,71.4297 z m 51.8125,66.668l 51.8125,38.0944l 51.8125,9.52411c 51.8125,4.26556 56.03,-3.05176e-005 61.233,-3.05176e-005c 66.4323,-3.05176e-005 70.6497,4.26556 70.6497,9.52411l 70.6497,38.0944l 70.6497,66.668l 70.6524,66.668c 70.6524,71.9218 66.4323,76.1901 61.233,76.1901c 56.03,76.1901 51.8125,71.9218 51.8125,66.668 z " />                     </viewbox>                 </grid>             </datatemplate>         </setter.value>     </setter> </style> 

it important pay attention path's fill property, can't white color, because when press on , hold it, default appbar icons become white, color should changed black, , therefore, use code get's foreground color parent - appbarbuttonstyle, has logic on appbar icon pressed. code:

fill="{binding path=foreground, relativesource={relativesource mode=templatedparent}}" 

one more thing, have used renders because image little bit crooked, have fixed rendering it, maybe not best way, works !

the last step add pages wanted use login appbar icon:

<button style="{staticresource logoutappbarbuttonstyle}" click="logout_click" /> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -