/// <summary> /// Toggle visibility for the given position/button. /// </summary> public void ToggleVisibility(Position position) { BaseArcButton button = new BaseArcButton(); switch (position) { case Position.Left: button = this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => x.Name == "Left"); button.Visibility = !button.Visibility; break; case Position.Right: button = this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => x.Name == "Right"); button.Visibility = !button.Visibility; break; case Position.Top: button = this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => x.Name == "Top"); button.Visibility = !button.Visibility; break; case Position.Bottom: button = this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => x.Name == "Bottom"); button.Visibility = !button.Visibility; break; case Position.Center: button = this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => x.Name == "Center"); button.Visibility = !button.Visibility; break; } }
/// <summary> /// Allows to update property for every buttons. /// </summary> public void UpdateButtonsProperty(string propertyName, object value) { var buttons = new BaseArcButton[] { this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => (Position)x.Tag == Position.Left), this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => (Position)x.Tag == Position.Right), this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => (Position)x.Tag == Position.Top), this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => (Position)x.Tag == Position.Bottom), this.Grid.Children.Cast <BaseArcButton>().FirstOrDefault(x => (Position)x.Tag == Position.Center) }; foreach (var button in buttons) { UpdateButtonProperty((Position)button.Tag, propertyName, value); } }