다음을 통해 공유


BindableObject.SetValue 메서드

정의

오버로드

SetValue(BindableProperty, Object)

지정된 바인딩 가능한 속성의 값을 설정합니다.

SetValue(BindablePropertyKey, Object)

지정된 바인딩 가능한 속성의 값을 설정합니다.

SetValue(BindableProperty, Object)

지정된 바인딩 가능한 속성의 값을 설정합니다.

public:
 void SetValue(Microsoft::Maui::Controls::BindableProperty ^ property, System::Object ^ value);
public void SetValue (Microsoft.Maui.Controls.BindableProperty property, object value);
member this.SetValue : Microsoft.Maui.Controls.BindableProperty * obj -> unit
Public Sub SetValue (property As BindableProperty, value As Object)

매개 변수

property
BindableProperty

값을 할당할 바인딩 가능한 속성입니다.

value
Object

설정할 값입니다.

예외

propertynull인 경우

설명

가 읽기 전용이면 property 아무 일도 일어나지 않습니다.

적용 대상

SetValue(BindablePropertyKey, Object)

지정된 바인딩 가능한 속성의 값을 설정합니다.

public:
 void SetValue(Microsoft::Maui::Controls::BindablePropertyKey ^ propertyKey, System::Object ^ value);
public void SetValue (Microsoft.Maui.Controls.BindablePropertyKey propertyKey, object value);
member this.SetValue : Microsoft.Maui.Controls.BindablePropertyKey * obj -> unit
Public Sub SetValue (propertyKey As BindablePropertyKey, value As Object)

매개 변수

propertyKey
BindablePropertyKey

값을 할당할 바인딩 가능한 속성을 식별하는 키입니다.

value
Object

설정할 값입니다.

예외

propertyKeynull인 경우

로 식별된 바인딩 가능한 속성이 propertyKey 읽기 전용인 경우 throw됩니다.

설명

이 메서드 및 BindablePropertyKey 는 쓰기 액세스가 제한된 BindableProperties를 구현하는 데 유용합니다. 쓰기 액세스는 BindablePropertyKey의 scope 제한됩니다.

다음 예제에서는 "내부" 쓰기 액세스 권한이 있는 BindableProperty를 선언하는 방법을 보여 있습니다.

class MyBindable : BindableObject
{
  internal static readonly BindablePropertyKey MyPropertyKey = 
    BindableProperty.CreateReadOnly<MyBindable, string> (w => w.My, default(string));
  public static readonly BindableProperty MyProperty = MyPropertyKey.BindableProperty;

  public string My {
    get { return (string)GetValue (MyProperty); }
    internal set { SetValue (MyPropertyKey, value); } 
  }
}

적용 대상