2011-10-21 21 views
0

我正在寫一個組件和它的皮膚。皮膚有一個"selected"狀態,它呈現與相應的發光的東西。 恰巧被選中狀態被保存在hostComponent的屬性中,該屬性在外部(不是通過皮膚上的直接用戶交互)設置/取消設置。如何讓皮膚知道hostComponent屬性值的變化?

我試圖使hostComponent一個SkinPart這個boolean財產,並在皮膚初始化設置了ChangeWatcher此屬性將觸發狀態變化。沒有雪茄。 :(

什麼是使通過hostComponent

回答

1
What's the way to make the skin's state change through the hostComponent? 

呼叫invalidateSkinState()在你的hostComponent的財產皮膚的狀態變化的方式。

這將反過來力的commitProperties將會在未來重新運行渲染事件,這會在commitProperties運行時強制getCurrentSkinState()重新運行

確保您的hostComponent實現getCurrentSkinState()並返回字符串值表示你想要去的國家。

+0

謝謝!像魅力一樣工作 – Dan