UIElement.IsEnabled 속성

정의

UI(사용자 인터페이스)에서 이 요소를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다. 이 속성은 종속성 속성입니다.

public:
 property bool IsEnabled { bool get(); void set(bool value); };
public bool IsEnabled { get; set; }
member this.IsEnabled : bool with get, set
Public Property IsEnabled As Boolean

속성 값

Boolean

요소를 사용하면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

예제

다음 예제에서는 실행 시 다른 명명된 단추에 설정 IsEnabled false 되는 한 단추 b1의 처리기를 보여 줍니다.

public partial class RoutedEventAddRemoveHandler {
    void MakeButton(object sender, RoutedEventArgs e)
    {
        Button b2 = new Button();
        b2.Content = "New Button";
        // Associate event handler to the button. You can remove the event 
        // handler using "-=" syntax rather than "+=".
        b2.Click  += new RoutedEventHandler(Onb2Click);
        root.Children.Insert(root.Children.Count, b2);
        DockPanel.SetDock(b2, Dock.Top);
        text1.Text = "Now click the second button...";
        b1.IsEnabled = false;
    }
    void Onb2Click(object sender, RoutedEventArgs e)
    {
        text1.Text = "New Button (b2) Was Clicked!!";
    }
Public Partial Class RoutedEventAddRemoveHandler
    Private Sub MakeButton(ByVal sender As Object, ByVal e As RoutedEventArgs)
        Dim b2 As Button = New Button()
        b2.Content = "New Button"
        AddHandler b2.Click, AddressOf Onb2Click
        root.Children.Insert(root.Children.Count, b2)
        DockPanel.SetDock(b2, Dock.Top)
        text1.Text = "Now click the second button..."
        b1.IsEnabled = False
    End Sub
    Private Sub Onb2Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        text1.Text = "New Button (b2) Was Clicked!!"
    End Sub

설명

이 속성은 런타임에 특정 요소에 대한 클래스별 구현의 IsEnabledCore 영향을 받습니다. 따라서 여기에 나열된 기본값은 효과적이지 않은 경우가 있습니다. 예를 들어 스크롤 막대를 ScrollBar 지원할 필요가 없다고 판단될 IsEnabled false 때마다 A가 표시됩니다. 이 값을 설정하려고 하면 반환된 값 IsEnabledCore으로 재정의될 수도 있습니다.

사용하도록 설정되지 않은 요소는 적중 횟수 테스트 또는 포커스에 참여하지 않으므로 입력 이벤트의 원본이 아닙니다.

종속성 속성 정보

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

적용 대상

추가 정보