wpf - How to highlight only one button out of 4 buttons -


i have 4 buttons on screen. when click 1 button loading grid data on same ui.

when click 2nd button clearing old data , binding new data corresponding grid.

i want highlight 1 button once clicked it.

i using mvvm pattern so.. need fix issue in xaml.

example:

i clicked 1st button load data on grid based on selection. button 1 should highlighted.

when click on 2nd button. button 1 should in normal state , 2nd button should highlighted.

only 1 button highlight should in highlighted mode until on view.

i think looking radiobuttons.

<window.resources>     <controltemplate x:key="rbtemplatekey" targettype="radiobutton">         <togglebutton ischecked="{binding ischecked, mode=twoway,relativesource={relativesource ancestortype=radiobutton, mode=findancestor}}"/>     </controltemplate> </window.resources>  <grid>     <stackpanel margin="141,148,161,0" orientation="horizontal" background="aliceblue">          <radiobutton width="25" height="25" margin="10" template="{staticresource rbtemplatekey}"/>         <radiobutton width="25" height="25" margin="10" template="{staticresource rbtemplatekey}"/>         <radiobutton width="25" height="25" margin="10" template="{staticresource rbtemplatekey}"/>         <radiobutton width="25" height="25" margin="10" template="{staticresource rbtemplatekey}"/>      </stackpanel> </grid> 

Comments