Пример #1
0
        private void AddResItem(PropTypeData prop)
        {
            ListBox listBox = null;
            if (prop is FloorTypeData)
            {
                listBox = floorResListBox;
            }
            else if (prop is BuildingTypeData)
            {
                listBox = buildingResListBox;
            }

            foreach (ResListBoxItem item in listBox.Items)
            {
                if (item.PropData == prop)
                {
                    return;
                }
            }

            ResListBoxItem listBoxItem = new ResListBoxItem(prop);
            listBoxItem.OnDel += OnDelRes;
            listBoxItem.OnEdit += OnEditRes;
            listBox.Items.Add(listBoxItem);
        }
Пример #2
0
        public ResListBoxItem(PropTypeData prop)
            : base()
        {
            PropData = prop;

            this.Height = 28;
            this.Content = prop;

            ContextMenu menu = new ContextMenu();
            MenuItem editItem = new MenuItem();
            editItem.Header = "编辑";
            editItem.Click += EditItem_Click;
            menu.Items.Add(editItem);

            MenuItem delItem = new MenuItem();
            delItem.Header = "删除";
            delItem.Click += DelItem_Click;
            menu.Items.Add(delItem);

            ContextMenu = menu;
        }
Пример #3
0
 public Prop(PropTypeData data)
 {
     Data = data;
 }