private Button GetButton(MetroWindow window, string buttonName) { var windowButtonCommands = window.FindChild<WindowButtonCommands>("PART_WindowButtonCommands"); Assert.NotNull(windowButtonCommands); var button = windowButtonCommands.Template.FindName(buttonName, windowButtonCommands) as Button; Assert.NotNull(button); return button; }