private void changeButtonStyle(Button button, bool isOn) { Style style; String buttonText = String.Empty; if (isOn) { style = this.FindResource("PointsOnButtonStyle") as Style; buttonText = "Hide " + button.Name; } else { style = this.FindResource("CustomButtonStyle") as Style; buttonText = "Show " + button.Name; } button.Style = style; button.Content = buttonText; }