c# - Default TabItem Background Color -
i want set background color of tabitem header (tabitem.background) if content not set in tab. accomplish this, have brush property in viewmodel bound background property of tabitem. however, i'm not sure how get/create default tabitem background brush.
public brush tabitembrush { { return iscontentset ? defaulttabitembrush : brushes.lightskyblue; } }
<tabitem header="some header" background="{binding tabitembrush, mode=oneway}">
i defaulttabitembrush brush match other tabitems if theme changes tabitems still same.
is default brush available in systemcolors?
using c# / .net 3.5
i ended using solution in wpf, how current theme's button background?
then in code looks like:
public brush tabitembrush { { return iscontentset ? (brush)uiutilities.getvaluefromstyle(typeof(tabitem), control.backgroundproperty) : brushes.lightskyblue; } }
<tabitem header="some header" background="{binding tabitembrush, mode=oneway}">
when iscontentset == true use default brush , when false other brush in case lightskyblue
Comments
Post a Comment