Пример #1
0
        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);
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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;
                    }
                }
            }
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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();
        }
Пример #6
0
        private static void OnGlyphChanged(BindableObject bindable, object oldValue, object newValue)
        {
            GlyphButton glyphButton = (GlyphButton)bindable;

            glyphButton.OnPropertyChanged("GlyphText");
        }
Пример #7
0
        private static void DisabledLabelColourChanged(BindableObject bindable, object oldValue, object newValue)
        {
            GlyphButton glyphButton = (GlyphButton)bindable;

            glyphButton.OnPropertyChanged("LabelColour");
        }