禁用列表框中的特定项目 [英] Disable particular item in the ListBox

查看:23
本文介绍了禁用列表框中的特定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将对象列表绑定到 WindowsPhone 应用程序中的 ListBox.此业务对象具有一个布尔属性.基于布尔属性,我需要在 ListBoxItem 中设置 IsEnabled 属性.

I bind list of objects to my ListBox in WindowsPhone application. This business object has one boolean property. Based on the Boolean property i need to set the IsEnabled property in the ListBoxItem.

有没有办法在 WindowsPhone ListBox 中实现这一点?

Is there any way to achieve this in WindowsPhone ListBox ?

推荐答案

有几种方法可以实现:

  1. 您可以通过 C# 代码添加 ListBoxItem 并正确设置属性.
  2. 在 Xaml 的列表框中,放置以下内容: