private static void AddToGroup(GlyphButton button, String group) { List <GlyphButton> groupButtons = null; if (_toggleGroups.ContainsKey(group)) { groupButtons = _toggleGroups[group]; } else { groupButtons = new List <GlyphButton>(); _toggleGroups.Add(group, groupButtons); } groupButtons.Add(button); }
private static void OnToggleGroupChanged(BindableObject bindable, object oldValue, object newValue) { GlyphButton glyphButton = (GlyphButton)bindable; String oldGroup = (String)oldValue; String newGroup = (String)newValue; if (!String.IsNullOrEmpty(oldGroup)) { RemoveFromGroup(glyphButton, oldGroup); } if (!String.IsNullOrEmpty(newGroup)) { AddToGroup(glyphButton, newGroup); } }
private static void UnpressAllInGroupExcept(String group, GlyphButton except) { List <GlyphButton> groupButtons = null; if (_toggleGroups.ContainsKey(group)) { groupButtons = _toggleGroups[group]; foreach (GlyphButton curButton in groupButtons) { if (curButton != except) { curButton._isUpdating = true; curButton.IsPressed = false; curButton._isUpdating = false; } } } }
static void OnIsPressedChanged(BindableObject bindable, object oldVal, object newVal) { GlyphButton glyphButton = (GlyphButton)bindable; Boolean newIsPressed = (Boolean)newVal; if (newIsPressed) { glyphButton.LayoutRoot.BackgroundColor = glyphButton.BackgroundColourToggledOn; glyphButton.GlyphIconLabel.TextColor = glyphButton.GlyphColourToggledOn; } else { glyphButton.LayoutRoot.BackgroundColor = glyphButton.BackgroundColor; glyphButton.GlyphIconLabel.TextColor = glyphButton.GlyphColour; } if (!glyphButton._isUpdating && !String.IsNullOrEmpty(glyphButton.ToggleGroup)) { UnpressAllInGroupExcept(glyphButton.ToggleGroup, glyphButton); } }
private static void OnModeChanged(BindableObject bindable, object oldValue, object newValue) { GlyphButton glyphButton = (GlyphButton)bindable; ButtonMode newMode = (ButtonMode)newValue; switch (newMode) { case ButtonMode.GlyphOnly: { glyphButton.GlyphIconLabel.HorizontalTextAlignment = TextAlignment.Center; glyphButton.GlyphIconLabel.VerticalTextAlignment = TextAlignment.Center; break; } case ButtonMode.GlyphAndTextLeftRight: { glyphButton.GlyphIconLabel.HorizontalTextAlignment = TextAlignment.Center; glyphButton.GlyphIconLabel.VerticalTextAlignment = TextAlignment.Center; glyphButton.GlyphTextLabel.HorizontalTextAlignment = TextAlignment.End; glyphButton.GlyphTextLabel.VerticalTextAlignment = TextAlignment.Center; break; } case ButtonMode.TextOnly: { glyphButton.GlyphTextLabel.HorizontalTextAlignment = TextAlignment.Center; glyphButton.GlyphTextLabel.VerticalTextAlignment = TextAlignment.Center; break; } } glyphButton.OnPropertyChanged("TextLabelIsVisible"); glyphButton.OnPropertyChanged("IconLabelIsVisible"); glyphButton.UpdateChildrenLayout(); }
private static void OnGlyphChanged(BindableObject bindable, object oldValue, object newValue) { GlyphButton glyphButton = (GlyphButton)bindable; glyphButton.OnPropertyChanged("GlyphText"); }
private static void DisabledLabelColourChanged(BindableObject bindable, object oldValue, object newValue) { GlyphButton glyphButton = (GlyphButton)bindable; glyphButton.OnPropertyChanged("LabelColour"); }