BindingOperations.GetBindingExpression 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정한 개체에서 지정한 바인딩 대상 속성에 연결된 된 BindingExpression 개체를 반환합니다.
public:
static System::Windows::Data::BindingExpression ^ GetBindingExpression(System::Windows::DependencyObject ^ target, System::Windows::DependencyProperty ^ dp);
public static System.Windows.Data.BindingExpression GetBindingExpression (System.Windows.DependencyObject target, System.Windows.DependencyProperty dp);
static member GetBindingExpression : System.Windows.DependencyObject * System.Windows.DependencyProperty -> System.Windows.Data.BindingExpression
Public Shared Function GetBindingExpression (target As DependencyObject, dp As DependencyProperty) As BindingExpression
매개 변수
- target
- DependencyObject
dp
가 있는 바인딩 대상 개체입니다.
BindingExpression 개체를 검색할 바인딩 대상 속성입니다.
반환
지정된 속성에 연결된 BindingExpression 개체입니다. 개체가 없는 경우 null
입니다. 속성에 PriorityBindingExpression 개체가 설정된 경우 ActiveBindingExpression이 반환됩니다.
예외
target
및 dp
매개 변수는 null
일 수 없습니다.
예제
다음 예제에서는 구현을 보여 줍니다를 Click 를 사용 하는 이벤트 처리기를 GetBindingExpression 메서드를 BindingExpression 를 호출 하는 DataItem 바인딩 소스 개체에 액세스 하는 속성.
는 TextBlockSavingsText
바인딩 대상 개체이며 Text 바인딩 대상 속성입니다.
private void OnRentRaise(Object sender, RoutedEventArgs args)
{
// Update bills
System.Random random = new System.Random();
double i = random.Next(10);
BindingExpression bindingExpression =
BindingOperations.GetBindingExpression(SavingsText, TextBlock.TextProperty);
SDKSample.NetIncome sourceData = (SDKSample.NetIncome) bindingExpression.DataItem;
sourceData.Rent = (int)((1 + i / 100) * (double)sourceData.Rent);
}
Private Sub OnRentRaise(ByVal sender As Object, ByVal args As RoutedEventArgs)
Dim _random As New System.Random()
Dim num1 As Double = _random.Next(10)
Dim expression1 As BindingExpression = BindingOperations.GetBindingExpression(Me.SavingsText, TextBlock.TextProperty)
Dim income1 As NetIncome = DirectCast(expression1.DataItem, NetIncome)
income1.Rent = CInt(((1 + (num1 / 100)) * income1.Rent))
End Sub
설명
개체는 BindingExpression 바인딩 원본과 바인딩 대상 간의 연결을 유지 관리합니다. 이 정적 메서드를 BindingExpression 호출하거나 데이터 바인딩 FrameworkElement 또는 FrameworkContentElement 개체에서 메서드를 호출 GetBindingExpression 하여 개체를 가져올 수 있습니다.
적용 대상
추가 정보
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기