2011-02-27 9 views

답변

2

코드 숨김에서 DataContext를 설정해야합니다. 따라서 페이지의 Load 이벤트에 다음을 입력하십시오.

this.DataContext = this; 

이미 완료 한 경우 자세한 내용을 게시해야합니다.

0

나는

public string Caption { get; set; } 

    void UserControl_Loaded(object sender, RoutedEventArgs e) 
    { 
     Caption = "Label"; 
    } 

<Label Content="Label" Height="28" Name="label1" DataContext="{Binding Caption}" /> 

XAML

에서 당신이 바쁜 표시등과 같은 일을 할 수 확신 레이블이 같은 있습니다.

6

Slugster 깔끔한 해결책을 가지고하지만 난 당신을 위해 무엇을 찾고있는 것은 솔루션 모두 일이

<Page x:Name="MyPage> 
<TabControl> 
    <TabItem> 
     <BusyIndicator IsBusy="{Binding ElementName=MyPage, Path=MyBooleanPropertyNameInCodeBehind}" /> 
    </TabItem> 
</TabControl> 

+0

그래, 그게 분명히 작동합니다. +1. – slugster

3

Slugster 및 AntSlay,라고 생각합니다. 나는이 작품도 발견 :

<Page DataContext="{Binding RelativeSource={RelativeSource Self}}"> 
    <TabControl> 
     <TabItem> 
      <BusyIndicator IsBusy="{Binding MyBooleanPropertyNameInCodeBehind}" /> 
     </TabItem> 
    </TabControl> 
</Page> 
관련 문제