Esempio n. 1
0
        private void CreateRatingButtons()
        {
            this.RatingButtonsInternal.Clear();
            for (var i = this.Minimum; i <= this.Maximum; i++)
            {
                RatingBarButton button = new RatingBarButton()
                {
                    Content         = i,
                    Value           = i,
                    IsSelected      = i <= Math.Ceiling(this.Value),
                    IsHalf          = this.IsInt(this.Value) ? false : Math.Ceiling(this.Value) == i,
                    ContentTemplate = this.ValueItemTemplate,
                    Style           = this.ValueItemStyle
                };
                button.ItemMouseEnter += (o, n) =>
                {
                    this.mOldValue  = this.Value;
                    this.Value      = button.Value;
                    this.mIsConfirm = false;
                };
                button.ItemMouseLeave += (o, n) =>
                {
                    if (!this.mIsConfirm)
                    {
                        this.Value      = this.mOldValue;
                        this.mIsConfirm = false;
                    }
                };

                this.RatingButtonsInternal.Add(button);
            }
            this.RatingButtons = this.RatingButtonsInternal;
        }
Esempio n. 2
0
        private void CreateRatingButtons()
        {
            this.RatingButtonsInternal.Clear();
            for (var i = this.Minimum; i <= this.Maximum; i++)
            {
                RatingBarButton button = new RatingBarButton()
                {
                    Content         = i,
                    Value           = i,
                    IsSelected      = i <= Math.Ceiling(this.Value),
                    IsHalf          = this.IsInt(this.Value) ? false : Math.Ceiling(this.Value) == i,
                    ContentTemplate = this.ValueItemTemplate,
                    Style           = this.ValueItemStyle
                };

                this.RatingButtonsInternal.Add(button);
            }
            this.RatingButtons = this.RatingButtonsInternal;
        }