ComboBox.PlaceholderText 속성

정의

사용자 작업 또는 다른 작업에 의해 값이 변경될 때까지 컨트롤에 표시되는 텍스트를 가져오거나 설정합니다.

public:
 property Platform::String ^ PlaceholderText { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring PlaceholderText();

void PlaceholderText(winrt::hstring value);
public string PlaceholderText { get; set; }
var string = comboBox.placeholderText;
comboBox.placeholderText = string;
Public Property PlaceholderText As String
<ComboBox PlaceholderText="placeholderString"/>

속성 값

String

Platform::String

winrt::hstring

값이 선택되지 않은 경우 컨트롤에 표시되는 텍스트입니다. 기본값은 빈 문자열("")입니다.

예제

ComboBox에 자리 표시자 텍스트를 추가하는 방법은 다음과 같습니다.

<ComboBox Header="Colors" PlaceholderText="Pick a color">
    <x:String>Blue</x:String>
    <x:String>Green</x:String>
    <x:String>Red</x:String>
    <x:String>Yellow</x:String>
</ComboBox>

설명

자리 표시자 텍스트는 SelectedIndex 가 -1이고 SelectedItemnull이면 표시됩니다. (이 두 속성은 동기화된 상태로 유지됩니다.) 항목을 선택한 후에는 사용자가 자리 표시자 텍스트를 표시할 수 없습니다. 그러나 프로그래밍 방식으로 SelectedIndex 를 -1로 설정하거나 SelectedItemnull 로 설정하여 자리 표시자 텍스트가 다시 표시되도록 할 수 있습니다.

적용 대상