ItemsControl.DisplayMemberPath 속성

정의

개체의 시각적 표시로 사용할 소스 개체의 값에 대한 경로를 가져오거나 설정합니다.

public:
 property System::String ^ DisplayMemberPath { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public string DisplayMemberPath { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.DisplayMemberPath : string with get, set
Public Property DisplayMemberPath As String

속성 값

String

소스 개체의 값에 대한 경로입니다. 모든 경로 또는 "@Name"와 같은 XPath일 수 있습니다. 기본값은 빈 문자열("")입니다.

특성

예제

다음 예제에서 명명된 places 정적 리소스는 각 Place 개체에 속성과 속성이 있는 개체의 Place 컬렉션으로 CityName State 정의됩니다. 접두사는 src 데이터 원본 Places 이 정의된 네임스페이스에 매핑됩니다. 접두사 scmdat 네임스페이 System.ComponentModel System.Windows.Data 스에 각각 매핑됩니다.

다음 예제에서는 도시 이름을 기준으로 정렬되고 주별로 그룹화된 데이터 컬렉션의 뷰를 만듭니다.

<Window.Resources>

  <src:Places x:Key="places"/>

  <CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
    <CollectionViewSource.SortDescriptions>
      <scm:SortDescription PropertyName="CityName"/>
    </CollectionViewSource.SortDescriptions>
    <CollectionViewSource.GroupDescriptions>
      <dat:PropertyGroupDescription PropertyName="State"/>
    </CollectionViewSource.GroupDescriptions>
  </CollectionViewSource>

뷰는 다음 예제와 같이 바인딩 소스일 수 있습니다. 지정된 DisplayMemberPath개체로 인해 각Place 개체가 해당 CityName 값으로 표시됩니다. 지정하지 않고 없는 DataTemplateListBox 경우 DisplayMemberPath 기본 컬렉션에 있는 각 개체의 문자열 표현(이 경우 "SDKSample.Place")이 표시됩니다.

<ListBox ItemsSource="{Binding Source={StaticResource cvs}}"
         DisplayMemberPath="CityName" Name="lb">
  <ListBox.GroupStyle>
    <x:Static Member="GroupStyle.Default"/>
  </ListBox.GroupStyle>
</ListBox>

설명

이 속성은 데이터 개체를 표시하는 방법을 설명하는 기본 템플릿을 정의하는 간단한 방법입니다.

종속성 속성 정보

식별자 필드 DisplayMemberPathProperty
메타 데이터 속성 설정 true 없음

적용 대상

추가 정보