c# - ListBox with Rounded Corners (Windows Store App) -
i have listbox
inside flyout
. there way of making listbox
corners rounded? have searched , couldn't find anything. there style/xaml
template recommend?
this code:
<flyout> <flyout.flyoutpresenterstyle> <style targettype="flyoutpresenter"> <setter property="margin" value="30,30,0,0"/> <setter property="background" value="transparent"/> <setter property="borderbrush" value="transparent"/> <setter property="borderthickness" value="0"/> <setter property="minheight" value="300"/> <setter property="minwidth" value="200"/> </style> </flyout.flyoutpresenterstyle> <listbox x:name="allitemsview" width="200" height="auto" borderthickness="0" verticalalignment="top" foreground="black" background="white" grid.rowspan="2" itemssource="{binding}" selectionmode="single" selectionchanged="allitemsview_selectionchanged"> <listbox.resources> <style targettype="border"> <setter property="cornerradius" value="20,20,20,20"/> <setter property="borderbrush" value="blueviolet"/> <setter property="borderthickness" value="7"/> <setter property="padding" value="5"/> </style> </listbox.resources> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="padding" value="0"/> <setter property="borderthickness" value="1"/> </style> </listbox.itemcontainerstyle> <listbox.itemtemplate> <datatemplate> <grid width="200" height="40" margin="0,0,0,0" name="colorgrid"> <grid.background> <solidcolorbrush color="{binding itemtype, mode=oneway, converter={staticresource itemtypetocolorconverter1}}" /> </grid.background> <stackpanel x:name="stackitem"> <textblock text="{binding itemtitle}" fontweight="{binding itemtype, converter={staticresource itemtypetoboldconverter1}}" margin="{binding itemtype, converter={staticresource itemtypetomarginconverter1}}" /> <textblock text="{binding itempage}" visibility="collapsed"/> </stackpanel> </grid> </datatemplate> </listbox.itemtemplate> </listbox> </flyout>
if want set cornerradius listbox, can same in resources instead
<listbox ...> <listbox.resources> <style targettype="border"> <setter property="cornerradius" value="10"/> </style> </listbox.resources> <!--...--> </listbox>
Comments
Post a Comment