코드 숨김에 부울 속성이있는 실버 라이트 페이지가 있습니다.Silverlight에서 페이지 속성에 바인딩하는 방법은 무엇입니까?
xaml에서 나는 tabcontrol을 가지고 있고 tabitem의 내용 중 하나는 busyindicator입니다.
busyindicator의 isbusy 속성을 코드 숨김의 부울 속성에 바인딩하고 싶지만 사용하는 바인딩 문과 상관없이 해결할 수 없습니다.
코드 숨김에 부울 속성이있는 실버 라이트 페이지가 있습니다.Silverlight에서 페이지 속성에 바인딩하는 방법은 무엇입니까?
xaml에서 나는 tabcontrol을 가지고 있고 tabitem의 내용 중 하나는 busyindicator입니다.
busyindicator의 isbusy 속성을 코드 숨김의 부울 속성에 바인딩하고 싶지만 사용하는 바인딩 문과 상관없이 해결할 수 없습니다.
코드 숨김에서 DataContext를 설정해야합니다. 따라서 페이지의 Load 이벤트에 다음을 입력하십시오.
this.DataContext = this;
이미 완료 한 경우 자세한 내용을 게시해야합니다.
나는
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
에서 당신이 바쁜 표시등과 같은 일을 할 수 확신 레이블이 같은 있습니다.Slugster 깔끔한 해결책을 가지고하지만 난 당신을 위해 무엇을 찾고있는 것은 솔루션 모두 일이
<Page x:Name="MyPage>
<TabControl>
<TabItem>
<BusyIndicator IsBusy="{Binding ElementName=MyPage, Path=MyBooleanPropertyNameInCodeBehind}" />
</TabItem>
</TabControl>
Slugster 및 AntSlay,라고 생각합니다. 나는이 작품도 발견 :
<Page DataContext="{Binding RelativeSource={RelativeSource Self}}">
<TabControl>
<TabItem>
<BusyIndicator IsBusy="{Binding MyBooleanPropertyNameInCodeBehind}" />
</TabItem>
</TabControl>
</Page>
그래, 그게 분명히 작동합니다. +1. – slugster