1
// Copyright © Microsoft Corporation.
2
// This source is subject to the Microsoft Source License for Silverlight Controls (March 2008 Release).
3
// Please see http://go.microsoft.com/fwlink/?LinkID=111693 for details.
4
// All other rights reserved.
6
using System.Globalization;
8
namespace System.Windows.Controlsb1
10
internal static class DataGridError
12
public static class DataGrid
14
public static InvalidOperationException CannotAddFrozenColumn()
16
return new InvalidOperationException(Resource.DataGrid_CannotAddFrozenColumn);
19
public static InvalidOperationException CannotAddNonFrozenColumn()
21
return new InvalidOperationException(Resource.DataGrid_CannotAddNonFrozenColumn);
24
public static InvalidOperationException CannotChangeColumnCollectionWhileAdjustingDisplayIndexes()
26
return new InvalidOperationException(Resource.DataGrid_CannotChangeColumnCollectionWhileAdjustingDisplayIndexes);
29
public static InvalidOperationException CannotMoveFrozenColumn()
31
return new InvalidOperationException(Resource.DataGrid_CannotMoveFrozenColumn);
34
public static InvalidOperationException CannotMoveNonFrozenColumn()
36
return new InvalidOperationException(Resource.DataGrid_CannotMoveNonFrozenColumn);
39
public static InvalidOperationException ColumnCannotBeCollapsed()
41
return new InvalidOperationException(Resource.DataGrid_ColumnCannotBeCollapsed);
44
public static InvalidOperationException ColumnCannotBeReassignedToDifferentDataGrid()
46
return new InvalidOperationException(Resource.DataGrid_ColumnCannotBeReassignedToDifferentDataGrid);
49
public static ArgumentException ColumnNotInThisDataGrid()
51
return new ArgumentException(Resource.DataGrid_ColumnNotInThisDataGrid);
54
public static InvalidOperationException CommitFailedCannotCompleteOperation()
56
return new InvalidOperationException(Resource.DataGrid_CommitFailedCannotCompleteOperation);
59
public static ArgumentException InvalidEnumValue(string value, string enumTypeName, string paramName)
61
return new ArgumentException(Format(Resource.DataGrid_InvalidEnumValue, value, enumTypeName), paramName);
64
public static ArgumentException InvalidRowElement(string paramName)
66
return new ArgumentException(Resource.DataGrid_InvalidRowElement, paramName);
69
public static ArgumentException ItemIsNotContainedInTheItemsSource(string paramName)
71
return new ArgumentException(Resource.DataGrid_ItemIsNotContainedInTheItemsSource, paramName);
74
public static InvalidOperationException ItemsSourceNullCannotCompleteOperation()
76
return new InvalidOperationException(Resource.DataGrid_ItemsSourceNullCannotCompleteOperation);
79
public static TypeInitializationException MissingTemplateForType(Type type)
81
return new TypeInitializationException(Format(Resource.DataGrid_MissingTemplateForType, type.FullName), null);
84
public static InvalidOperationException NoCurrentRow()
86
return new InvalidOperationException(Resource.DataGrid_NoCurrentRow);
89
public static InvalidOperationException NoOwningGrid(Type type)
91
return new InvalidOperationException(Format(Resource.DataGrid_NoOwningGrid, type.FullName));
94
public static InvalidOperationException UnderlyingPropertyIsReadOnly()
96
return new InvalidOperationException(Resource.DataGrid_UnderlyingPropertyIsReadOnly);
99
public static ArgumentNullException ValueCannotBeSetToNull(string paramName, string valueName)
101
return new ArgumentNullException(paramName, Format(Resource.DataGrid_ValueCannotBeSetToNull, valueName));
104
public static ArgumentException ValueIsNotAnInstanceOf(string paramName, Type type)
106
return new ArgumentException(paramName, Format(Resource.DataGrid_ValueIsNotAnInstanceOf, type.FullName));
109
public static ArgumentException ValueIsNotAnInstanceOfEitherOr(string paramName, Type type1, Type type2)
111
return new ArgumentException(paramName, Format(Resource.DataGrid_ValueIsNotAnInstanceOfEitherOr, type1.FullName, type2.FullName));
114
public static InvalidOperationException ValueIsReadOnly(string paramName)
116
return new InvalidOperationException(Format(Resource.DataGrid_ValueIsReadOnly, paramName));
119
public static ArgumentOutOfRangeException ValueMustBeBetween(string paramName, string valueName, object lowValue, bool lowInclusive, object highValue, bool highInclusive)
121
string message = null;
123
if (lowInclusive && highInclusive)
125
message = Resource.DataGrid_ValueMustBeGTEandLTE;
127
else if (lowInclusive && !highInclusive)
129
message = Resource.DataGrid_ValueMustBeGTEandLT;
131
else if (!lowInclusive && highInclusive)
133
message = Resource.DataGrid_ValueMustBeGTandLTE;
137
message = Resource.DataGrid_ValueMustBeGTandLT;
140
return new ArgumentOutOfRangeException(paramName, Format(message, valueName, lowValue, highValue));
143
public static ArgumentOutOfRangeException ValueMustBeGreaterThanOrEqualTo(string paramName, string valueName, object value)
145
return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeGreaterThanOrEqualTo, valueName, value));
148
public static ArgumentOutOfRangeException ValueMustBeLessThanOrEqualTo(string paramName, string valueName, object value)
150
return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeLessThanOrEqualTo, valueName, value));
153
public static ArgumentOutOfRangeException ValueMustBeGreaterThan(string paramName, string valueName, object value)
155
return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeGreaterThan, valueName, value));
158
public static ArgumentOutOfRangeException ValueMustBeLessThan(string paramName, string valueName, object value)
160
return new ArgumentOutOfRangeException(paramName, Format(Resource.DataGrid_ValueMustBeLessThan, valueName, value));
165
public static class DataGridDataErrorEventArgs
167
public static ArgumentException CannotThrowNullException()
169
return new ArgumentException(Resource.DataGridDataErrorEventArgs_NullException);
173
public static class DataGridRow
175
public static InvalidOperationException InvalidRowIndexCannotCompleteOperation()
177
return new InvalidOperationException(Resource.DataGridRow_InvalidRowIndexCannotCompleteOperation);
181
public static class DataGridSelectedItemsCollection
183
public static InvalidOperationException CannotChangeSelectedItemsCollectionInSingleMode()
185
return new InvalidOperationException(Resource.DataGridSelectedItemsCollection_CannotChangeSelectedItemsCollectionInSingleMode);
189
private static string Format(string formatString, params object[] args)
191
return String.Format(CultureInfo.CurrentCulture, formatString, args);