예제 #1
0
        protected IView getView(String name)
        {
            IView view = null;

            switch (name)
            {
            case "transactions":
                view = new TransactionView(mViewHelper);
                break;

            case "investors":
                view = new InvestorView(mViewHelper);
                break;

            case "composite":
                view = new CompositeView(mViewHelper);
                break;

            case "login":
                view = new LoginView(mViewHelper);
                break;

            default:
                break;
            }

            return(view);
        }
예제 #2
0
 public static void UpdateLayoutManager(this CompositeView compositeView)
 {
     if (!(compositeView.LayoutManager is ILayoutManager))
     {
         var layoutManager = LayoutManager;
         if (layoutManager != null)
         {
             compositeView.SetPropertyInfoBackingFieldValue(view => compositeView.LayoutManager, compositeView, layoutManager);
         }
     }
 }
예제 #3
0
 public static void UpdateLayoutManager(this CompositeView compositeView)
 {
     if (!(compositeView.LayoutManager is ILayoutManager))
     {
         var layoutManager = GetLayoutManager(compositeView is ListView, compositeView.DelayedItemsInitialization);
         if (layoutManager != null)
         {
             compositeView.SetPropertyInfoBackingFieldValue(view => compositeView.LayoutManager, compositeView, layoutManager);
         }
     }
 }
        public void Build(IEnumerable<Player> players)
        {
            Children = new List<View>();

            int badgesWidth = (badgeDictionary.Count - 1) * 15;
            double labelWidth = Width - badgesWidth - 25;

            LabelView topListTextView = new LabelView("Top 7")
            {
                X = 5,
                Width = Width - 10,
                Height = 15,
                Y = 5,
            };

            double offsetY = 25;

            foreach (Player player in players.Take(7))
            {

                CompositeView row = new CompositeView(Width, 20)
                    {
                        new LabelView(" " + player.PlayerName + " ")
                        {
                            Width = labelWidth,
                            Height = 10,
                            Align = TextAlignment.Left,
                            Y = 5
                        },
                    };
                double spacing = 0;
                foreach (var badge in player.Badges)
                {
                    row.Add(new ImageView(badgeDictionary[badge], 15, 15)
                    {
                        X = labelWidth + spacing,
                        Y = 2.5
                    });
                    spacing += 15;
                }
                frameView = new FrameView(Width, 20, row);

                row.X = 5;
                row.Y = offsetY;
                row.Width = Width - 10;
                row.BackgroundColor = new Color(239, 239, 239);
                Children.Add(row);

                offsetY += 25;
            }
            Children.Add(topListTextView);
        }
예제 #5
0
 private void InitGraphics()
 {
     if (Frame is NestedFrame)
     {
         parentView = ((NestedFrame)Frame).ViewItem.View;
         ImagePropertyEditor imageEditor = parentView.FindItem("Photo") as ImagePropertyEditor;
         if (imageEditor != null)
         {
             var ctrl = imageEditor.Control;
             pEdit = (XafPictureEdit)ctrl;
         }
     }
 }
예제 #6
0
        private void OnSelectedHeroItemChanged(SelectHeroItem item, int dataIndex, CompositeView <SelectHeroItem> parent)
        {
            bool flag     = this.select_heros != null && dataIndex >= 0 && dataIndex < this.select_heros.Count;
            bool isMaster = dataIndex == this.select_heros.Count - 1;

            if (flag)
            {
                string text = this.select_heros[dataIndex];
                item.SetActive(true);
                item.ShowHero(text, true);
                item.name = text;
                item.UpdateSelect(true, isMaster);
            }
            else
            {
                item.ShowHero(string.Empty, true);
                item.name = string.Empty;
                item.UpdateSelect(false, isMaster);
            }
            item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeSelectedHero);
        }
예제 #7
0
        private void OnHeroItemChanged(HeroItem item, int dataIndex, CompositeView <HeroItem> parent)
        {
            string text       = this.all_heros[dataIndex];
            bool   isMaster   = this.select_heros.LastIndexOf(text) == this.select_heros.Count - 1;
            bool   isSelected = this.select_heros.Contains(text);

            item.name       = text;
            item.battletype = this.battle_type;
            item.ShowHero(text, false);
            if (this.battle_type == BattleType.YZ)
            {
                if (this.TBCCheckLive(text, item))
                {
                    item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeFavouredHero);
                }
            }
            else
            {
                item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeFavouredHero);
            }
            item.UpdateSelect(isSelected, isMaster);
        }
예제 #8
0
        void BuildFromDatasource(DataSourcePropertyAttribute dataSourcePropertyAttribute, Action <IEnumerable <string>, bool> itemsCalculated, Func <bool> itemsCalculating)
        {
            CompositeView compositeView = _propertyEditor.View;

            if (compositeView != null)
            {
                if (_propertyEditor.ObjectTypeInfo.IsPersistent)
                {
                    compositeView.ObjectSpace.ObjectChanged += (sender, args) => BuildFromDatasourceCore(dataSourcePropertyAttribute, itemsCalculated, itemsCalculating, args.PropertyName);
                }
                else
                {
                    ((INotifyPropertyChanged)_propertyEditor.CurrentObject).PropertyChanged += (sender, args) => BuildFromDatasourceCore(dataSourcePropertyAttribute, itemsCalculated, itemsCalculating, args.PropertyName);
                }
                var b = itemsCalculating.Invoke();
                if (!b)
                {
                    var boxItems = GetComboBoxItemsCore(dataSourcePropertyAttribute);
                    itemsCalculated.Invoke(boxItems, false);
                }
            }
        }
예제 #9
0
 public static XafApplication Application(this CompositeView view) => (XafApplication)view.GetPropertyValue("Application");
        public void Build(CurrentPlayer user)
        {
            MenuButton = new ButtonView("Menu", () => { if (OnExit != null) { OnExit(); } })
            {
                Width = 75,
                Height = 30,
                BackgroundColor = new Color(193, 57, 43),
                TextColor = new Color(255, 255, 255),
            };

            TitelView = new CompositeView(200, 40)
            {
                X = 100,
                Y = 10,
            };
            CategoryName = new LabelView(user.Categories[Category].Name)
            {
                Width = TitelView.Width * 0.6,
                Height = TitelView.Height,
                X = TitelView.X - (TitelView.Width * 0.6) / 2
            };

            StarTextView = new LabelView("")
            {
                Width = TitelView.Width * 0.15,
                Height = 15,
                X = CategoryName.X + CategoryName.Width + 7.5,
                Y = CategoryName.Y + ((CategoryName.Height) / 2) - 7.5
            };

            StarView = new ImageView("star_activated.png", TitelView.Width * 0.10, TitelView.Width * 0.10)
            {
                X = CategoryName.X + CategoryName.Width + StarTextView.Width + 10,
                Y = CategoryName.Y + 0.5 * (TitelView.Width * 0.10)
            };

            BadgeView = new ImageView("tutorialbadge.png", TitelView.Width * 0.15, TitelView.Width * 0.15)
            {
                X = 0 - ((TitelView.Width * 0.10) / 2) + 5,
                Y = CategoryName.Y + (0.5 * (TitelView.Width * 0.15)) - 10
            };

            TitelView.Add(StarTextView);
            TitelView.Add(CategoryName);
            TitelView.Add(StarView);
            TitelView.Add(BadgeView);

            Levels = new FrameView(Width - 100, Height - (CategoryName.Y + CategoryName.Height))
            {
                X = 50,
                Y = CategoryName.Y + CategoryName.Height,
            };

            ArrowRight = new VectorImageView(345, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 0,0    },
                { 25,75/2 },
                { 0,75   },
            };

            ArrowRight.Visible = Category < user.Categories.Count - 1;
            ArrowRight.BackgroundColor = new Color(44, 119, 130);
            ArrowRight.OnClick = () =>
            {
                if (Category < user.Categories.Count - 1)
                {
                    Category++;
                    OnChanged();
                }
            };

            ArrowLeft = new VectorImageView(5, Levels.Y + Levels.Height / 2 - 75 / 2, 50, 75)
            {
                { 25,75/2 },
                { 50,0    },
                { 50,75   },
            };

            ArrowLeft.BackgroundColor = new Color(44, 119, 130);
            ArrowLeft.OnClick = () =>
            {
                if (Category > 0)
                {
                    Category--;
                    OnChanged();
                }
            };
            ArrowLeft.Visible = Category > 0;

            Children.Add(MenuButton);
            Children.Add(ArrowLeft);
            Children.Add(ArrowRight);
            Children.Add(Levels);
            Children.Add(TitelView);

            Update(user);
        }
        /// <summary>
        /// Updates the view based on the selected category. 
        /// </summary>
        /// <param name="user"></param>
        public void Update(CurrentPlayer user)
        {
            CategoryName.Text = user.Categories[Category].Name;
            ArrowLeft.Visible = Category > 0;
            ArrowRight.Visible = Category < user.Categories.Count - 1;
            int totalStars = user.Categories[Category].Count * 3;
            int userStarsInCategory = 0;

            CompositeView levelButtons = new CompositeView(400, 400);

            int levelNumber = 0;
            int numberOfLevels = user.Categories[Category].Count;
            foreach (Level level in user.Categories[Category])
            {
                // adds a button for each level in category
                userStarsInCategory += level.Stars;
                CompositeView levelButton = new CompositeView(40, 40)
                {   OnClick = () => OnLevelSelect(level),
                    X = levelNumber % (int)Math.Sqrt(numberOfLevels) * 50 + 5,
                    Y = levelNumber / (int)Math.Sqrt(numberOfLevels) * 50 + 5,
                    BackgroundColor = level.Unlocked ? new Color(40, 130, 120) : new Color(190, 190, 190)
                };
                // gives each levelbutton a level number
                levelButton.Add(
                    new LabelView((levelNumber + 1).ToString())
                    {
                        Width = levelButton.Width,
                        Height = levelButton.Width * 0.75,
                        BackgroundColor = level.Unlocked ? new Color(40, 130, 120) : new Color(190, 190, 190),
                        TextColor = new Color(255, 255, 255),
                    });
                double starsize = levelButton.Width * 0.25;
                // Centeres the stars horizontally
                double startPostition = (levelButton.Width - (starsize)) / 2;
                if (level.Stars == 2)
                {
                    startPostition = levelButton.Width / 2 - starsize;
                }
                else if (level.Stars == 3)
                {
                    startPostition = (levelButton.Width - (starsize)) / 2 - starsize;
                }
                for (int n = 0; n < level.Stars; n++)
                {
                    levelButton.Add(new ImageView("star_activated.png", starsize, starsize)
                    {
                        Y = levelButton.Height - starsize,
                        X = startPostition
                    });
                    startPostition += starsize;
                }
                levelButtons.Add(levelButton);
                levelNumber += 1;
                // finds the badge associated with the specific category
                switch (user.Categories[Category].Name)
                {
                    case "Tutorial":
                        BadgeView.Image = "tutorial_badge.png";
                        break;

                    case "Potenser":
                        BadgeView.Image = "potens_badge.png";
                        break;

                    case "Brøker":
                        BadgeView.Image = "brøkbadge.png";
                        break;

                    case "Parenteser":
                        BadgeView.Image = "parenthesis_badge.png";
                        break;

                    case "Master of Algebra":
                        BadgeView.Image = "master_of_algebrabadge.png";
                        break;
                    default:
                        break;
                }

            }
            // shows how many start the user have out of the total amount of start possible
            StarTextView.Text = userStarsInCategory + " / " + totalStars;
            levelButtons.Width = (int)Math.Sqrt(numberOfLevels) * 50;
            levelButtons.Height = levelNumber / (int)Math.Sqrt(numberOfLevels) * 50;
            Levels.SetContent(levelButtons);
        }
예제 #12
0
        public void Build(GameModel game)
        {
            CurrentPlayer user = game.User;
            IEnumerable<Player> players = game.Players;
            BackgroundColor = new Color(255, 255, 255);
            WelcomeText = new LabelView("Velkommen " + user.PlayerName)
            {
                X = 10,
                Y = 10,
                Height = 50,
                Width = 220
            };

            BadgesView = new CompositeView(220, 40)
            {
                X = WelcomeText.X,
                Y = WelcomeText.Y + WelcomeText.Height
            };

            BadgeInfoText = new LabelView("Badges: ")
            {
                Width = 100,
                Height = 20,
                X = -10
            };

            BadgesView.Add(BadgeInfoText);

            if (user.Badges != null)
            {
                // start spacing half the width of a badge
                int spacing = -10;
                foreach (BadgeName badge in user.Badges)
                {
                    if (PlayerView.badgeDictionary.ContainsKey(badge))
                    {
                        BadgesView.Add(new ImageView(PlayerView.badgeDictionary[badge], 25, 25)
                        {
                            X = BadgeInfoText.X + BadgeInfoText.Width + spacing,
                        });
                    }
                    spacing += 30;
                }
            }

            VectorImageView playIcon = new VectorImageView(0, 0, 100, 100)
            {
                { 25,25 },
                { 75,50 },
                { 25,75 }
            };

            LogoutButton = new ButtonView("Log ud", () =>
            {
                if (OnLogout != null)
                {
                    OnLogout();
                }
            })
            {
                Width = 50,
                Height = 15,
                TextColor = new Color(255, 255, 255),
                BackgroundColor = new Color(193, 57, 43)
            };

            playIcon.BackgroundColor = new Color(255, 255, 255);
            PlayButton = new CompositeView(100, 100)
            {
                playIcon,
            };
            PlayButton.BackgroundColor = new Color(39, 174, 97);
            PlayButton.X = 10;
            PlayButton.Y = BadgesView.Y + BadgesView.Height;
            VectorImageView levelIcon1 = new VectorImageView(0, 0, 100, 100)
            {
                { 20,20 },
                { 45,20 },
                { 45,45 },
                { 20,45 },
                { 20,20 },
            };
            VectorImageView levelIcon2 = new VectorImageView(0, 0, 100, 100)
            {
                { 80,20 },
                { 80,45 },
                { 55,45 },
                { 55,20 },
                { 80,20 },
            };
            VectorImageView levelIcon3 = new VectorImageView(0, 0, 100, 100)
            {
                { 80,80 },
                { 55,80 },
                { 55,55 },
                { 80,55 },
                { 80,80 },
            };
            VectorImageView levelIcon4 = new VectorImageView(0, 0, 100, 100)
            {
                { 20,80 },
                { 20,55 },
                { 45,55 },
                { 45,80 },
                { 20,80 },
            };
            levelIcon1.BackgroundColor = new Color(255, 255, 255);
            levelIcon2.BackgroundColor = new Color(255, 255, 255);
            levelIcon3.BackgroundColor = new Color(255, 255, 255);
            levelIcon4.BackgroundColor = new Color(255, 255, 255);

            LevelButton = new CompositeView(100, 100)
            {
                levelIcon1,
                levelIcon2,
                levelIcon3,
                levelIcon4,
            };
            LevelButton.BackgroundColor = new Color(42, 128, 185);
            LevelButton.X = PlayButton.X + PlayButton.Width + 20;
            LevelButton.Y = BadgesView.Y + BadgesView.Height;

            PlayerList = new PlayerListView(players, 160, 200)
            {
                X = LevelButton.X + LevelButton.Width + 20,
                Y = WelcomeText.Y
            };

            Children = new List<View>(){
                LogoutButton,
                WelcomeText,
                LevelButton,
                PlayerList,
                PlayButton,
                BadgesView
            };
        }
        public View BuildView(ExpressionBase expression, ExpressionModel model)
        {
            // Find the type of the root of the expression-tree

            // Only the first case is commented fully. The rest is only commented if they do something special
            // To check if the root is a type, we try to cast it and check if its null
            UnaryMinusExpression minusExpression = expression as UnaryMinusExpression;
            if(minusExpression != null) // Root is minus-expression
            {
                View view = BuildView(minusExpression.Expression, model); // Call BuildView recursively with next level of expression
                view.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color();  // set backgoundcolor

                OperatorView operatorView = new OperatorView(minusExpression.Type); // Instantiate a operatorView with a minus, to be rendered to screen
                operatorView.Width = NUMVAR_SIZE / 2; // Position and size after preset constants
                operatorView.Height = NUMVAR_SIZE;
                operatorView.Baseline = NUMVAR_SIZE / 2;
                operatorView.OnClick = () => model.Select(minusExpression); // When minus is clicked, select it
                operatorView.LineColor = expression.Selected ? new Color(39, 174, 97) : new Color(0, 0, 0);
                operatorView.LineWidth = NUMVAR_SIZE / 15;

                view.X = operatorView.Width; // Put rest of expression on the right of the minus
                operatorView.Y = view.Baseline - operatorView.Baseline;

                View minusView = new CompositeView(operatorView.Width + view.Width, view.Height) { operatorView, view }; // Join the minus and the rest of the expressionView
                minusView.Baseline = view.Baseline; // Minus has same baseline as the rest
                minusView.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color(); // If minus is selected it has another backgroundcolor

                return minusView;
            }

            BinaryOperatorExpression operatorExpression = expression as BinaryOperatorExpression;
            if (operatorExpression != null)
            {
                View left = BuildView(operatorExpression.Left, model);
                View right = BuildView(operatorExpression.Right, model);
                OperatorView operatorView = new OperatorView(operatorExpression.Type);
                switch (operatorExpression.Type) //Switch on the type of operator
                {
                    case OperatorType.Divide:
                        // Divide needs to place right under left and put a line between.
                        double width = System.Math.Max(left.Width, right.Width) + NUMVAR_SIZE;
                        operatorView.Width = width;
                        operatorView.Height = NUMVAR_SIZE / 1.5;
                        operatorView.Y = left.Height;
                        operatorView.Baseline = NUMVAR_SIZE / 2;
                        operatorView.OnClick = () => model.Select(expression);
                        operatorView.LineWidth = NUMVAR_SIZE / 12;
                        operatorView.LineColor = expression.Selected ? new Color(39, 174, 97) : new Color(0, 0, 0);

                        right.Y = left.Height + operatorView.Height;
                        left.X = (width - left.Width) / 2;
                        right.X = (width - right.Width) / 2;

                        CompositeView fraction = new CompositeView(width, left.Height + operatorView.Height + right.Height)
                        {
                            left,
                            operatorView,
                            right
                        };
                        fraction.Baseline = operatorView.Y + operatorView.Height / 2;
                        fraction.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color();
                        return fraction;
                    case OperatorType.Power:
                        // Power lifts right a bit
                        right.X = left.Width;
                        left.Y = right.Height - NUMVAR_SIZE / 2; // Lift right
                        CompositeView exponent = new CompositeView(right.X + right.Width, left.Y + left.Height)
                        {
                            left,
                            right
                        };
                        exponent.Baseline = left.Y + left.Baseline;
                        exponent.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color();
                        return exponent;
                }
            }
            VariadicOperatorExpression variadicExpression = expression as VariadicOperatorExpression;
            if (variadicExpression != null)
            {
                List<View> views = new List<View>();
                double offsetX = 0;
                double height = 0;
                double maxBaseline = NUMVAR_SIZE / 2;
                // Variadic may have more than 2 "sides"
                foreach (ExpressionBase expr in variadicExpression)
                {
                    View operand;
                    if (views.Count != 0)
                    {
                        UnaryMinusExpression minus = expr as UnaryMinusExpression;
                        OperatorView operatorView;
                        if (variadicExpression.Type == OperatorType.Add && minus != null)
                        {
                            operatorView = new OperatorView(OperatorType.Subtract);
                            operand = BuildView(minus.Expression, model);
                            operand.BackgroundColor = ReferenceEquals(model.Selected, expr) ? SelectionBackgroundColor : new Color();
                            operatorView.BackgroundColor = operand.BackgroundColor;
                            operatorView.OnClick = () => model.Select(minus);
                            operatorView.LineColor = minus.Selected ? SelectionTextColor : new Color(0, 0, 0);
                        }
                        else
                        {
                            operatorView = new OperatorView(variadicExpression.Type);
                            operand = BuildView(expr, model);
                        }
                        operatorView.X = offsetX;
                        operatorView.Width = (variadicExpression.Type == OperatorType.Multiply ? 0.5 : 1.5)  * NUMVAR_SIZE;
                        operatorView.Height = NUMVAR_SIZE;
                        operatorView.Baseline = NUMVAR_SIZE / 2;
                        operatorView.LineWidth = NUMVAR_SIZE / (variadicExpression.Type == OperatorType.Multiply ? 25 : 15);
                        views.Add(operatorView);
                        offsetX += operatorView.Width;
                    }
                    else
                    {
                        operand = BuildView(expr, model);
                    }
                    if (ReferenceEquals(expr.Parent, model.Selected) && (expr.Selected || expr.GetNodesRecursive().Any((n) => n.Selected)))
                    {
                        operand.BackgroundColor = SelectionBackgroundColor;
                    }

                    maxBaseline = System.Math.Max(maxBaseline, operand.Baseline);
                    operand.X = offsetX;
                    offsetX += operand.Width;
                    views.Add(operand);
                }
                foreach (View view in views) // Join all the views
                {
                    view.Y = maxBaseline - view.Baseline;
                    height = System.Math.Max(height, view.Y + view.Height);
                }
                return new CompositeView(offsetX, height) { Children = views, Baseline = maxBaseline };
            }
            // TODO: Comment this
            DelimiterExpression delimiterExpression = expression as DelimiterExpression;
            if(delimiterExpression != null)
            {
                View view = BuildView(delimiterExpression.Expression, model);
                view.X = view.Height / 3;
                view.Y = NUMVAR_SIZE / 8;
                ParenthesisView left = new ParenthesisView(ParenthesisType.Left) { OnClick = () => model.Select(expression), Width = view.Height / 3, Height = view.Height + NUMVAR_SIZE / 4 };
                ParenthesisView right = new ParenthesisView(ParenthesisType.Right) { OnClick = () => model.Select(expression), X = view.Width + view.Height / 3, Width = view.Height / 3, Height = view.Height + NUMVAR_SIZE / 4 };

                View compositeView = new CompositeView(view.Width + view.Height / 1.5, view.Height + NUMVAR_SIZE / 4)
                {
                    left,
                    view,
                    right
                };
                left.LineWidth = NUMVAR_SIZE / 15;
                right.LineWidth = NUMVAR_SIZE / 15;
                left.LineColor = expression.Selected ? SelectionTextColor : new Color(0, 0, 0);
                right.LineColor = expression.Selected ? SelectionTextColor : new Color(0, 0, 0);
                compositeView.Baseline = view.Y + view.Baseline;
                compositeView.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color();
                return compositeView;
            }
            // TODO: Comment this
            FunctionExpression functionExpression = expression as FunctionExpression;
            if(functionExpression != null && functionExpression.Function == "sqrt")
            {
                View view = BuildView(functionExpression.Expression, model);
                SqrtView sqrtView = new SqrtView();
                sqrtView.OnClick = () => model.Select(expression);
                sqrtView.SignWidth = view.Height / 2;
                sqrtView.TopHeight = NUMVAR_SIZE / 2;
                sqrtView.LineWidth = NUMVAR_SIZE / 12;
                sqrtView.Width = view.Width + sqrtView.SignWidth + NUMVAR_SIZE / 4;
                sqrtView.LineColor = expression.Selected ? SelectionTextColor : new Color(0, 0, 0);
                sqrtView.Height = view.Height + sqrtView.TopHeight;
                view.X = sqrtView.SignWidth + NUMVAR_SIZE / 8;
                view.Y = sqrtView.TopHeight;
                View compositeView = new CompositeView(sqrtView.Width, sqrtView.Height)
                {
                    sqrtView,
                    view,
                };
                compositeView.Baseline = view.Baseline + sqrtView.TopHeight;
                compositeView.BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color();
                return compositeView;
            }
            return new LabelView(expression.ToString())
            {
                OnClick = () => model.Select(expression),
                Width = 3 * NUMVAR_SIZE / 5 * (expression.ToString().Length + 0.25),
                Height = NUMVAR_SIZE,
                Baseline = NUMVAR_SIZE / 2,
                TextColor = expression.Selected ? new Color(39, 174, 97) : new Color(0, 0, 0),
                BackgroundColor = ReferenceEquals(model.Selected, expression) ? SelectionBackgroundColor : new Color()
            };
        }