DialogPropertyValueEditor 클래스

업데이트: 2007년 11월

PropertyEntry 개체에 대한 모든 대화 상자 편집 논리의 컨테이너입니다.

네임스페이스:  Microsoft.Windows.Design.PropertyEditing
어셈블리:  Microsoft.Windows.Design(Microsoft.Windows.Design.dll)

구문

Public Class DialogPropertyValueEditor _
    Inherits PropertyValueEditor

Dim instance As DialogPropertyValueEditor
public class DialogPropertyValueEditor : PropertyValueEditor
public ref class DialogPropertyValueEditor : public PropertyValueEditor
public class DialogPropertyValueEditor extends PropertyValueEditor

설명

DialogPropertyValueEditor 클래스를 사용하면 대화 상자 편집기에 연결할 수 있는 인라인 편집기를 표시할 수 있습니다.

DialogPropertyValueEditor 클래스는 대화 상자가 호출될 때 호출되는 사용자 지정 논리 또는 대화 상자 편집기에 대한 DataTemplate을 보유할 수 있습니다.

DataTemplate에서 EditModeSwitchButton을 사용하여 사용자 지정 DialogPropertyValueEditor 클래스를 호출합니다.

호스트 대화 상자에 표시되는 DataTemplate을 제공하거나 ShowDialog 메서드를 재정의하여 기존 또는 시스템 대화 상자를 다시 사용하도록 설정할 수 있습니다.

다음 목록에서는 DataTemplate 또는 ShowDialog 메서드 중에서 무엇을 사용할지 결정하기 위한 규칙을 보여 줍니다.

  • DialogEditorTemplate 속성이 nullNull 참조(Visual Basic의 경우 Nothing)이 아닌 경우 해당 DataTemplate는 호스트 스타일 지정을 제공하는 호스트 관련 대화 상자에서 호스팅됩니다. ShowDialog는 호출되지 않습니다.

  • DialogEditorTemplate 속성이 nullNull 참조(Visual Basic의 경우 Nothing)인 경우 가상 ShowDialog 메서드가 호출되고 이 메서드를 재정의하여 모든 대화 상자를 표시할 수 있습니다.

예제

다음 코드 예제에서는 속성 창에서 FileName 사용자 지정 속성을 클릭하면 파일 열기 대화 상자를 표시하는 대화 상자 속성 값 편집기를 만드는 방법을 보여 줍니다. 자세한 내용은 방법: 대화 상자 속성 값 편집기 만들기를 참조하십시오.

using System;
using System.ComponentModel;
using System.Windows;
using Microsoft.Windows.Design.Metadata;
using Microsoft.Windows.Design.PropertyEditing;
using Microsoft.Win32;

namespace CustomControlLibrary.Design
{
    public class FileBrowserDialogPropertyValueEditor : DialogPropertyValueEditor
    {
        private EditorResources res = new EditorResources();

        public FileBrowserDialogPropertyValueEditor()
        {
            this.InlineEditorTemplate = res["FileBrowserInlineEditorTemplate"] as DataTemplate;
        }

        public override void ShowDialog(
            PropertyValue propertyValue,
            IInputElement commandSource)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = false;

            if (ofd.ShowDialog() == true)
            {
                propertyValue.StringValue = ofd.FileName;
            }
        }
    }
}
<ResourceDictionary xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:PropertyEditing="clr-namespace:Microsoft.Windows.Design.PropertyEditing;assembly=Microsoft.Windows.Design"
                    xmlns:Local="clr-namespace:CustomControlLibrary.Design"
                    x:Class="CustomControlLibrary.Design.EditorResources">

    <DataTemplate x:Key="FileBrowserInlineEditorTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBox Grid.Column="0" Text="{Binding StringValue}"/>
            <PropertyEditing:EditModeSwitchButton Grid.Column="1"/>
        </Grid>
    </DataTemplate>

</ResourceDictionary>

상속 계층 구조

System.Object
  Microsoft.Windows.Design.PropertyEditing.PropertyValueEditor
    Microsoft.Windows.Design.PropertyEditing.DialogPropertyValueEditor

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

DialogPropertyValueEditor 멤버

Microsoft.Windows.Design.PropertyEditing 네임스페이스

EditModeSwitchButton

PropertyEntry

PropertyValue

PropertyValueEditorCommands

IInputElement

기타 리소스

속성 편집 아키텍처

WPF Designer 확장성