コード例 #1
0
        private void DataGrid_KeyUp(object sender, KeyEventArgs e)
        {
            DataGrid grid = (DataGrid) sender;
            if(e.Key == Key.NumPad0 || e.Key == Key.D0)
            {
                foreach (DataGridRow row in grid.Items)
                {
                    row.IsSelected = !row.IsSelected;
                }
            }
            if(   (e.Key >= Key.NumPad1 && e.Key <=Key.NumPad9)
               || (e.Key >= Key.D1 && e.Key <=Key.D9))
            {
                KeyConverter converter = new KeyConverter();

                try
                {
                    int select = (int)converter.ConvertTo(e.Key,typeof(int));
                    DataGridRow row = (DataGridRow)grid.Items[select];
                    row.IsSelected = !row.IsSelected;
                }
                catch (Exception)
                {

                }
            }
        }
コード例 #2
0
 void KeyDownHandler(object sender, KeyEventArgs e)
 {
     KeyConverter kc = new KeyConverter();
     keyStrokes = keyStrokes + kc.ConvertTo(e.Key, typeof(string));
 }
コード例 #3
0
ファイル: CadAgente.xaml.cs プロジェクト: GeoOjacob/sppdi
        private void txtRg_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            KeyConverter kv = new KeyConverter();

            if (e.Key == Key.Tab) return;
            if ((char.IsNumber((string)kv.ConvertTo(e.Key, typeof(string)), 0) == false))
            {
                e.Handled = true;
            }
        }