Inheritance: System.Windows.Controls.DataGrid
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/%E5%A5%A5%E6%9E%AB%E7%87%83%E6%B0%94%E8%90%A5%E6%94%B6%E7%B3%BB%E7%BB%9FV3;compo" +
                                                                   "nent/Pages/%E6%B0%91%E7%94%A8%E6%8A%84%E8%A1%A8%E6%89%B9%E9%87%8F%E5%BD%95%E5%85" +
                                                                   "%A5.xaml", System.UriKind.Relative));
     this.LayoutRoot      = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.jichalist       = ((Com.Aote.ObjectTools.ObjectList)(this.FindName("jichalist")));
     this.sellgaslist     = ((Com.Aote.ObjectTools.ObjectList)(this.FindName("sellgaslist")));
     this.sourceObj       = ((Com.Aote.ObjectTools.GeneralObject)(this.FindName("sourceObj")));
     this.toObj           = ((Com.Aote.ObjectTools.GeneralObject)(this.FindName("toObj")));
     this.SaveAction      = ((Com.Aote.Behaviors.BatchExcuteAction)(this.FindName("SaveAction")));
     this.daninfosearch   = ((System.Windows.Controls.StackPanel)(this.FindName("daninfosearch")));
     this.tjwhf_Copy      = ((System.Windows.Controls.TextBox)(this.FindName("tjwhf_Copy")));
     this.tjwhf_Copy1     = ((System.Windows.Controls.TextBox)(this.FindName("tjwhf_Copy1")));
     this.dansearchbutton = ((System.Windows.Controls.Button)(this.FindName("dansearchbutton")));
     this.saveButton      = ((System.Windows.Controls.Button)(this.FindName("saveButton")));
     this.daninfos        = ((Com.Aote.Controls.CustomDataGrid)(this.FindName("daninfos")));
 }
示例#2
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            //配置单元格索引
            string inputIndex = CustomDataGrid.GetInputIndex(this);
            //是否跳行
            bool isNextRow = true;
            //当前索引行
            int nextIndex = this.CurrentColumn.DisplayIndex;

            if (e.Key.Equals(Key.Tab) || e.Key.Equals(Key.Enter))
            {
                e.Handled = true;
                int            currentRow = this.SelectedIndex;
                BaseObjectList ol         = (BaseObjectList)this.ItemsSource;
                if (currentRow < ol.Size - 1)
                {
                    e.Handled = true;
                    if (ol[currentRow + 1] != null)
                    {
                        //默认跳转
                        if (inputIndex == null)
                        {
                            GeneralObject go = ol[currentRow + 1];
                            this.SelectedIndex = currentRow + 1;
                            DataGridColumn fe = this.Columns[this.CurrentColumn.DisplayIndex];
                            this.CurrentColumn = fe;
                            this.ScrollIntoView(go, fe);
                            FrameworkElement c = (FrameworkElement)this.CurrentColumn.GetCellContent(go);
                            c.GetType().GetMethod("Focus").Invoke(c, null);
                        }
                        //计算是否跳转下一行何列位置
                        else
                        {
                            string[] ins = inputIndex.Split(new char[] { '|' });
                            for (int i = 0; i < ins.Length; i++)
                            {
                                int w = int.Parse(ins[i]);
                                if (w == this.CurrentColumn.DisplayIndex)
                                {
                                    //当期索引== 配置的结束索引,下一行,第一个索引
                                    if (i == ins.Length - 1)
                                    {
                                        isNextRow = true;
                                        nextIndex = int.Parse(ins[0]);
                                        break;
                                    }
                                    //当期那索引==配置的索引未结束,下一个索引
                                    else
                                    {
                                        isNextRow = false;
                                        nextIndex = int.Parse(ins[i + 1]);
                                        break;
                                    }
                                }
                            }
                            GeneralObject go = ol[currentRow];
                            if (isNextRow)
                            {
                                go = ol[currentRow + 1];
                                this.SelectedIndex = currentRow + 1;
                            }
                            DataGridColumn fe = this.Columns[nextIndex];
                            this.CurrentColumn = fe;
                            this.ScrollIntoView(go, fe);
                            FrameworkElement c = (FrameworkElement)this.CurrentColumn.GetCellContent(go);
                            c.GetType().GetMethod("Focus").Invoke(c, null);
                        }
                    }
                }
            }
            else
            {
                base.OnKeyDown(e);
            }
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/%E5%A5%A5%E6%9E%AB%E7%87%83%E6%B0%94%E8%90%A5%E6%94%B6%E7%B3%BB%E7%BB%9FV3;compo" +
                 "nent/Pages/%E6%B0%91%E7%94%A8%E6%8A%84%E8%A1%A8%E6%89%B9%E9%87%8F%E5%BD%95%E5%85" +
                 "%A5.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.jichalist = ((Com.Aote.ObjectTools.ObjectList)(this.FindName("jichalist")));
     this.sellgaslist = ((Com.Aote.ObjectTools.ObjectList)(this.FindName("sellgaslist")));
     this.sourceObj = ((Com.Aote.ObjectTools.GeneralObject)(this.FindName("sourceObj")));
     this.toObj = ((Com.Aote.ObjectTools.GeneralObject)(this.FindName("toObj")));
     this.SaveAction = ((Com.Aote.Behaviors.BatchExcuteAction)(this.FindName("SaveAction")));
     this.daninfosearch = ((System.Windows.Controls.StackPanel)(this.FindName("daninfosearch")));
     this.tjwhf_Copy = ((System.Windows.Controls.TextBox)(this.FindName("tjwhf_Copy")));
     this.tjwhf_Copy1 = ((System.Windows.Controls.TextBox)(this.FindName("tjwhf_Copy1")));
     this.dansearchbutton = ((System.Windows.Controls.Button)(this.FindName("dansearchbutton")));
     this.saveButton = ((System.Windows.Controls.Button)(this.FindName("saveButton")));
     this.daninfos = ((Com.Aote.Controls.CustomDataGrid)(this.FindName("daninfos")));
 }