private void UpdateButtons() { int visibleButtonsCount = this.GetButtonsInView(); int totalButtons = this.buttons.Count; int hiddenButtonsCount = totalButtons - visibleButtonsCount; this.footerTrayPanel.Children.Clear(); for (int i = hiddenButtonsCount; i > 0; i--) { AttributeConfigurationButton button = this.buttons[totalButtons - i] as AttributeConfigurationButton; this.AddToFooterTray(button); } }
private void SelectItem(AttributeConfigurationButton attributeConfigurationButton) { foreach (var button in buttons) { if (button == attributeConfigurationButton) { if (!button.IsSelected) { button.IsSelected = true; } } else { if (button.IsSelected) { button.IsSelected = false; } } } }
private void AddToFooterTray(AttributeConfigurationButton button) { AttributeConfigurationButton footerTrayButton = new AttributeConfigurationButton(); Image image = new Image(); if (button.Header is Image) { image.Source = (button.Header as Image).Source; } footerTrayButton.Header = image; footerTrayButton.Content = button.Content; footerTrayButton.Tag = button; footerTrayButton.MouseLeftButtonDown += AttributeConfigurationButton_MouseLeftButtonDown; var isSelectedbinding = new Binding("IsSelected") { Source = button, Mode = BindingMode.TwoWay }; footerTrayButton.SetBinding(AttributeConfigurationButton.IsSelectedProperty, isSelectedbinding); this.footerTrayPanel.Children.Add(footerTrayButton); }
protected override DependencyObject GetContainerForItemOverride() { var attributeConfigurationButton = new AttributeConfigurationButton(); return(attributeConfigurationButton); }
protected override DependencyObject GetContainerForItemOverride() { var attributeConfigurationButton = new AttributeConfigurationButton(); return attributeConfigurationButton; }