Beispiel #1
0
        public static void SetSelectedItems(this DataGrid dataGrid, IList items)
        {
            DataGridSelectColumn column = GetSelectColumn(dataGrid);

            if (column == null)
            {
                throw new Exception("No Select Column");
            }

            column.SetSelectedItems(items);
        }
Beispiel #2
0
        public static void UnselectAll(this DataGrid dataGrid)
        {
            DataGridSelectColumn column = GetSelectColumn(dataGrid);

            if (column == null)
            {
                throw new Exception("No Select Column");
            }

            column.UnselectAll();
        }
Beispiel #3
0
        public static List <T> GetSelectedItems <T>(this DataGrid dataGrid)
        {
            DataGridSelectColumn column = GetSelectColumn(dataGrid);

            if (column == null)
            {
                throw new Exception("No Select Column");
            }

            return(column.GetSelectedItems <T>());
        }
Beispiel #4
0
        internal static DataGridSelectColumn GetSelectColumn(this DataGrid dataGrid)
        {
            DataGridSelectColumn result = null;

            for (int i = 0; i < dataGrid.Columns.Count; i++)
            {
                result = dataGrid.Columns[i] as DataGridSelectColumn;

                if (result != null)
                {
                    break;
                }
            }

            return(result);
        }