Xaml Inherited StaticResource Styles -


i using style resources buttons. wondering better do.

<stackpanel grid.row="1">     <button content="create event" click="createevent_click" style="{staticresource navigationbutton}" />     <button content="search event" click="searchevent_click" style="{staticresource navigationbutton}" />     <button content="my events" click="myevents_click" style="{staticresource navigationbutton}" /> </stackpanel> 

so, if have many buttons need write style="{staticresource navigationbutton}"

or choose one:

<stackpanel grid.row="1">     <stackpanel.resources>         <style targettype="button" basedon="{staticresource navigationbutton}" />     </stackpanel.resources>     <button content="create event" click="createevent_click" />     <button content="search event" click="searchevent_click" />     <button content="my events" click="myevents_click" /> </stackpanel> 

best put styling in app.xaml under app resources. better solution on page because resource created once (instead of on multiple pages when reused).

also, can specify target type following. way not have reference style way did in example. define style here:

    <application.resources>         <style targettype="{x:type button}">             <setter property="background" value="black" />             <setter property="foreground" value="white" />             <setter property="width" value="80" />             <setter property="margin" value="10" />         </style>     </application.resources> 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -