zoukankan      html  css  js  c++  java
  • 100125项目点滴(分组+标序号)

        public class TabItemInfo {
            public string Header { get; set; }
            public Color Color { get; set; }
        }
    void MainPage_Loaded(object sender, RoutedEventArgs e) {
        var tabList = new List<TabItemInfo>() { 
            new TabItemInfo() { Header= "A" , Color = Colors.Red},
            new TabItemInfo() { Header= "B" , Color = Colors.Green},
            new TabItemInfo() { Header= "B" ,  Color = Colors.Green},
            new TabItemInfo() { Header= "A" , Color = Colors.Red},
            new TabItemInfo() { Header= "A" , Color = Colors.Red},
            new TabItemInfo() { Header= "C" , Color = Colors.Blue},
            new TabItemInfo() { Header= "A" ,Color = Colors.Red},
            new TabItemInfo() { Header= "B" ,Color = Colors.Green}
        };
    
        var dict = new Dictionary<string, int>();
        for (int i = 0; i < tabList.Count; i++) {
            if (!dict.Keys.Contains(tabList[i].Header)) {
                dict.Add(tabList[i].Header, 1);
                tabList[i].Header = string.Concat(tabList[i].Header, "(", 1, ")");
            }
            else {
                int max = dict[tabList[i].Header];
                dict[tabList[i].Header] = ++max;
                tabList[i].Header = string.Concat(tabList[i].Header, "(", max, ")");
            }
        }
    
        foreach (var tab in tabList) {
            tabControl1.Items.Add(
                new TabItem() { Header = tab.Header, Background = new SolidColorBrush(tab.Color) });
        }
    
    }
        <Grid x:Name="LayoutRoot">
            <controls:TabControl x:Name="tabControl1">
                
            </controls:TabControl>
        </Grid>
    image
  • 相关阅读:
    转:PCIe基础知识
    转:HDMI介绍与流程
    Java EJB JBoss
    冒泡排序
    多线程
    快排
    Talk is cheap,show me the code
    oracle union
    Oracle 【to_number】【instr】
    DB 【ACID】
  • 原文地址:https://www.cnblogs.com/024hi/p/1655978.html
Copyright © 2011-2022 走看看