public static object GetCommandParameter(this ImageToggleButton button) { var innerButtonField = button.GetType().GetField("innerButton", BindingFlags.Instance | BindingFlags.NonPublic); var innerButton = innerButtonField.GetValue(button) as Button; return(innerButton.CommandParameter); }
public static void SetCommandParameter(this ImageToggleButton button, object commandParameter) { var innerButtonField = button.GetType().GetField("toggleInnerButton", BindingFlags.Instance | BindingFlags.NonPublic); var innerButton = innerButtonField.GetValue(button) as System.Windows.Controls.Primitives.ToggleButton; innerButton.CommandParameter = commandParameter; }