2014-11-24 78 views
0
<Grid DataContext="{StaticResource BaseViewModel}"> 
     <DockPanel> 
      <TabContro> 
       <TabItem DataContext="{StaticResource MainWindowsViewModel}"> 
        <Tabs:Main /> 
       </TabItem> 
      </TabControl> 
     </DockPanel> 
     <Popup IsOpen="{Binding Path=Common.IsLoading}"> 
      <Control Style="{StaticResource BusyAnimationStyle}"/> 
     </Popup> 
</Grid> 

並結合靜態單屬性時爲null屬性的PropertyChanged

問題是當MainWindowVM更改IsLoading屬性時它不起作用 PropertyChanged爲空 任何解決方案?

+0

不,不明白這個問題。可能是一堆東西。沒有足夠的信息來說明發生了什麼。 – Will 2014-11-24 18:36:22

回答

0

您試圖從Common類綁定到IsLoading,但您的綁定意味着IsLoading是靜態的,但它不是。

你或許應該有一個這樣的綁定:

{Binding Source={x:Static Common.Instance}, Path=IsLoading} 

你也應該使用屬性來訪問你單身:

public static Common Instance { 
    get {return _instance??(_instance = new Common());} 
}