GridColumnStylesCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤에 있는 DataGridColumnStyle 개체의 DataGrid 컬렉션을 나타냅니다.
public ref class GridColumnStylesCollection : System::Windows::Forms::BaseCollection, System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class GridColumnStylesCollection : System.Windows.Forms.BaseCollection, System.Collections.IList
[<System.ComponentModel.ListBindable(false)>]
type GridColumnStylesCollection = class
inherit BaseCollection
interface IList
interface ICollection
interface IEnumerable
Public Class GridColumnStylesCollection
Inherits BaseCollection
Implements IList
- 상속
- 특성
- 구현
예제
다음 코드 예제에서는 각각 DataGridColumnStyleGridColumnStylesCollection에 대한 정보를 출력합니다.
void PrintColumnInformation( DataGrid^ grid )
{
Console::WriteLine( "Count: {0}", grid->TableStyles->Count );
GridColumnStylesCollection^ myColumns;
DataGridTableStyle^ myTableStyle;
for ( __int32 i = 0; i < grid->TableStyles->Count; i++ )
{
myTableStyle = grid->TableStyles[ i ];
myColumns = myTableStyle->GridColumnStyles;
/* Iterate through the collection and print each
object's type and width. */
DataGridColumnStyle^ dgCol;
for ( __int32 j = 0; j < myColumns->Count; j++ )
{
dgCol = myColumns[ j ];
Console::WriteLine( dgCol->MappingName );
Console::WriteLine( dgCol->GetType()->ToString() );
Console::WriteLine( dgCol->Width );
}
}
}
private void PrintColumnInformation(DataGrid grid){
Console.WriteLine("Count: " + grid.TableStyles.Count);
GridColumnStylesCollection myColumns;
foreach(DataGridTableStyle myTableStyle in grid.TableStyles){
myColumns = myTableStyle.GridColumnStyles;
/* Iterate through the collection and print each
object's type and width. */
foreach (DataGridColumnStyle dgCol in myColumns){
Console.WriteLine(dgCol.MappingName);
Console.WriteLine(dgCol.GetType().ToString());
Console.WriteLine(dgCol.Width);
}
}
}
Private Sub PrintColumnInformation(grid as DataGrid)
Console.WriteLine("Count: " & grid.TableStyles.Count)
Dim myTableStyle As DataGridTableStyle
Dim myColumns As GridColumnStylesCollection
Dim dgCol As DataGridColumnStyle
For Each myTableStyle in grid.TableStyles
myColumns = myTableStyle.GridColumnStyles
' Iterate through the collection and print each
' object's type and width.
For Each dgCol in myColumns
Console.WriteLine(dgCol.MappingName)
Console.WriteLine(dgCol.GetType.ToString())
Console.WriteLine(dgCol.Width)
Next
Next
End Sub
설명
에서 DataGridTableStyle속성을 통해 액세스 GridColumnStylesCollection 합니다 GridColumnStyles .
표준 GridColumnStylesCollectionAdd 및 Remove 메서드를 사용하여 컬렉션을 조작합니다.
메서드를 Contains 사용하여 컬렉션에 특정 속성 값이 있는지 확인합니다. 또한 메서드를 IndexOf 사용하여 컬렉션 내의 모든 DataGridColumnStyle 개체의 인덱스 확인
Caution
항상 개체를 만들고 DataGridColumnStyle 개체를 추가하기 GridColumnStylesCollection 전에 DataGridTableStyle 개체를 GridTableStylesCollection추가합니다. 컬렉션 DataGridTableStyle 에 유효한 MappingName 값이 있는 빈 DataGridColumnStyle 항목을 추가하면 개체가 자동으로 생성됩니다. 따라서 중복 DataGridColumnStyle 값이 있는 새 MappingName 개체를 추가하려고 하면 예외가 GridColumnStylesCollectionthrow됩니다.
속성
| Name | Description |
|---|---|
| Count |
컬렉션의 총 요소 수를 가져옵니다. (다음에서 상속됨 BaseCollection) |
| IsReadOnly |
컬렉션이 읽기 전용인지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 BaseCollection) |
| IsSynchronized |
액세스 ICollection 가 동기화되는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 BaseCollection) |
| Item[Int32] |
지정된 인덱스에서 DataGridColumnStyle 가져옵니다. |
| Item[PropertyDescriptor] | |
| Item[String] |
DataGridColumnStyle 지정된 이름을 가진 값을 가져옵니다. |
| List |
컬렉션의 항목 목록을 가져옵니다. |
| SyncRoot |
BaseCollection대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다. (다음에서 상속됨 BaseCollection) |
메서드
이벤트
| Name | Description |
|---|---|
| CollectionChanged |
를 변경할 때 발생합니다 GridColumnStylesCollection. |
명시적 인터페이스 구현
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
대상 배열의 지정된 인덱스에서 시작하여 호환되는 1차원 Array으로 컬렉션을 복사합니다. |
| ICollection.Count |
컬렉션에 포함된 요소 수를 가져옵니다. |
| ICollection.IsSynchronized |
GridColumnStylesCollection 대한 액세스가 동기화되는지 여부를 나타내는 값을 가져옵니다(스레드로부터 안전). |
| ICollection.SyncRoot |
GridColumnStylesCollection대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다. |
| IEnumerable.GetEnumerator() |
컬렉션의 열거자를 반환합니다. |
| IList.Add(Object) |
컬렉션에 개체를 추가합니다. |
| IList.Clear() |
개체 컬렉션을 DataGridColumnStyle 지웁니다. |
| IList.Contains(Object) |
요소가 컬렉션에 있는지 여부를 확인합니다. |
| IList.IndexOf(Object) |
컬렉션에서 지정된 개체가 처음 나타나는 인덱스(0부터 시작)를 반환합니다. |
| IList.Insert(Int32, Object) |
이 메서드는 이 컨트롤에서 지원되지 않습니다. |
| IList.IsFixedSize |
컬렉션의 크기가 고정되어 있는지 여부를 나타내는 값을 가져옵니다. |
| IList.IsReadOnly |
컬렉션이 읽기 전용인지 여부를 나타내는 값을 가져옵니다. |
| IList.Item[Int32] |
지정된 인덱스에서 요소를 가져옵니다. |
| IList.Remove(Object) |
에서 지정된 DataGridColumnStyle 값을 GridColumnStylesCollection제거합니다. |
| IList.RemoveAt(Int32) |
지정된 인덱스에서 해당 인덱스를 DataGridColumnStyle제거합니다GridColumnStylesCollection. |
확장명 메서드
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
쿼리의 병렬 처리를 사용하도록 설정합니다. |
| AsQueryable(IEnumerable) |
IEnumerable IQueryable변환합니다. |
| Cast<TResult>(IEnumerable) |
IEnumerable 요소를 지정된 형식으로 캐스팅합니다. |
| OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable 요소를 필터링합니다. |