WdGraphTabItemConfig.xaml.cs 1.98 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

潘栩锋's avatar
潘栩锋 committed
16
namespace MultiLayout.MainEdit
潘栩锋's avatar
潘栩锋 committed
17 18 19 20
{
    /// <summary>
    /// Window_MainEditGraphTabItem.xaml 的交互逻辑
    /// </summary>
21
    public partial class WdGraphTabItemConfig : FLY.ControlLibrary.WindowBigClose
潘栩锋's avatar
潘栩锋 committed
22
    {
潘栩锋's avatar
潘栩锋 committed
23
        ObservableCollection<MeGraphTabItem> Items;
潘栩锋's avatar
潘栩锋 committed
24 25
        int Idx;
        GraphTabItem_RC ItemRC;
26
        public WdGraphTabItemConfig()
潘栩锋's avatar
潘栩锋 committed
27 28 29
        {
            InitializeComponent();
        }
潘栩锋's avatar
潘栩锋 committed
30
        public void Init(ObservableCollection<MeGraphTabItem> items, int idx)
潘栩锋's avatar
潘栩锋 committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
        {
            Items = items;
            Idx = idx;
            ItemRC = new GraphTabItem_RC();
            ItemRC.ColCnt = Items[Idx].ColCnt;
            ItemRC.RowCnt = Items[Idx].RowCnt;
            this.grid_graphTabItem.DataContext = Items[Idx];
            this.grid_RC.DataContext = ItemRC;
        }
        private void button_pre_Click(object sender, RoutedEventArgs e)
        {
            if (Idx > 0)
            {
                Items.Move(Idx, Idx - 1);
                Idx--;
            }
        }
        private void button_next_Click(object sender, RoutedEventArgs e)
        {
            if (Idx < Items.Count()-1)
            {
                Items.Move(Idx, Idx + 1);
                Idx++;
            }
        }

        private void button_apply_Click(object sender, RoutedEventArgs e)
        {
            Items[Idx].RefreshRC(ItemRC.RowCnt, ItemRC.ColCnt);
        }
    }
    public class GraphTabItem_RC : INotifyPropertyChanged
    {

潘栩锋's avatar
潘栩锋 committed
65 66 67 68
        public int ColCnt { get; set; } = 1;


        public int RowCnt { get; set; } = 1;
潘栩锋's avatar
潘栩锋 committed
69 70 71 72 73


        public event PropertyChangedEventHandler PropertyChanged;
    }
}