0
我將對象列表綁定到WindowsPhone應用程序中的ListBox。此業務對象具有一個布爾屬性。基於布爾屬性,我需要在ListBoxItem中設置IsEnabled屬性。禁用ListBox中的特定項目
有沒有什麼辦法可以在WindowsPhone ListBox中實現這一點?
我將對象列表綁定到WindowsPhone應用程序中的ListBox。此業務對象具有一個布爾屬性。基於布爾屬性,我需要在ListBoxItem中設置IsEnabled屬性。禁用ListBox中的特定項目
有沒有什麼辦法可以在WindowsPhone ListBox中實現這一點?
有幾個是方法來實現這一目標:
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="IsEnabled" Value="{Binding Content.IsEnabled, RelativeSource={RelativeSource Self}}"/>
</Style>
</ListBox.Resources>
在這裏,我認爲在你的模型對象的屬性名稱的IsEnabled,更改根據其真實姓名。