Beispiel #1
0
        void CreateCells(int p_count)
        {
            Random rnd = new Random();

            for (int i = 0; i < p_count; i++)
            {
                FvCell cell = new FvCell();
                if ((i + 1) % 4 == 0)
                {
                    cell.ShowTitle = false;
                    //TextBlock tb = new TextBlock { Text = $"空格{_fv.Items.Count + 1}", VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
                    //cell.Editor = tb;
                }
                else
                {
                    cell.Title = $"单元格{_fv.Items.Count + 1}";
                }
                cell.RowSpan = rnd.Next(1, 3);
                _fv.Items.Add(cell);

                if ((i + 1) % 8 == 0)
                {
                    CBar sep = new CBar();
                    sep.Title = $"分隔行{_fv.Items.Count + 1}";
                    _fv.Items.Add(sep);
                }
            }
        }
Beispiel #2
0
        void OnAddClick(object sender, RoutedEventArgs e)
        {
            FvCell cell = new FvCell();

            cell.Title = $"单元格{_fv.Items.Count + 1}";
            _fv.Items.Add(cell);
        }
Beispiel #3
0
        public static void OnCellClick(FvCell p_tgtCell, Fv p_fv)
        {
            if (p_fv.Data == p_tgtCell)
            {
                return;
            }

            var items = p_fv.Items;

            using (items.Defer())
            {
                items.Clear();
                FvCell cell = new CBool();
                cell.ID    = "IsReadOnly";
                cell.Title = "只读";
                items.Add(cell);

                foreach (var info in p_tgtCell.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
                {
                    // 可设置属性
                    var attr = (CellParamAttribute)info.GetCustomAttribute(typeof(CellParamAttribute), false);
                    if (attr == null)
                    {
                        continue;
                    }

                    cell       = Fv.CreateCell(info.PropertyType, info.Name);
                    cell.Title = attr.Title;
                    items.Add(cell);
                }
            }
            p_fv.Data = p_tgtCell;
        }
Beispiel #4
0
        public static void OnChanged(Fv p_fv, ICell p_tgtCell)
        {
            FvCell cell = p_fv[p_tgtCell.ID];

            if (cell != null)
            {
                Kit.Msg($"{cell.Title}:{(p_tgtCell.Val != null ? p_tgtCell.Val : "空")}");
            }
            else
            {
                Kit.Msg($"{p_tgtCell.ID}:{(p_tgtCell.Val != null ? p_tgtCell.Val : "空")}");
            }
        }
Beispiel #5
0
 void OnCellClick(object sender, FvCell e)
 {
     _ob.Data = e;
 }
Beispiel #6
0
 internal void SetOwner(FvCell p_cell)
 {
     _owner = p_cell;
     OnShowTitleChanged();
 }