我有一個具有特定功能的靜態類來提供資源路徑。目前我只是在所有視圖模型的綁定函數中創建包裝。我想知道在Windows Phone 8.1中是否有某種方式將靜態功能直接綁定到圖像源。 在wpf Objectdataprovider中會很有用,但它在windows store應用程序中不受支持。我也無法找到任何文檔。在Windows Store應用中使用靜態方法進行綁定
<Rectangle.Fill>
<ImageBrush Stretch="Fill"
ImageSource="{Binding ImagePath"/>
</Rectangle.Fill>
在此先感謝
你可以修改函數的屬性?如果是這樣,你可以綁定到像靜態屬性[this](http://stackoverflow.com/questions/936304/binding-to-static-property) – kennyzx 2014-09-28 08:30:59
之前試過。得到這個錯誤「類型FooBar是抽象的,必須包含一個明確的值」 但我還沒有將類轉換爲非靜態。 – 2014-09-28 08:45:13
爲什麼你使用函數而不是屬性有什麼特別的原因嗎? 'ImagePath'好像應該是屬性而不是函數。 – 2014-09-28 08:52:11