private void ButtonSelecte(ToolButton btn) { if (CellListBox.SelectedIndex == -1) { return; } int index = CellListBox.SelectedIndex; // 处理一下颜色问题 ToolListItem item = CellListBox.SelectedItem as ToolListItem; Binding binding = new Binding(); binding.Source = item.indexer; binding.Path = new System.Windows.PropertyPath(BorderBrushProperty); btn.SetBinding(BackgroundProperty, binding); // 数据层 btn.C = json.list[index]; isChangedMap = 1; }