To set a style given a resource name, implement a setter like the following:
In the resources file should be the referenced name:
In the resources file should be the referenced name:
Style x:Key="BtnMenuStyle" TargetType="Button"And the setter as follows:
public string SetStyle {
set
{
Style st = (Style)FindResource(value);
if (st != null)
{
Btn.Style = st;
}
}
get
{
return Btn.Style.ToString();
}
}