0

我被困在 SetBinding 方法上。

我想在表格中有两种图标,会有一个布尔属性,显示的图标将取决于这个属性。这是一个例子:

问题是我无法更改图标。我试着用谷歌搜索了大约 3 个小时,但没有成功。

我的想法是放在那里图像控件,而不是更改源依赖属性,但我无法找到如何更改图像源。

因此,我尝试使用图像模板和 SetBinding 创建自定义示例,但我被卡住了……

  int index = 0;

  foreach (var item in this.VidContentItems) {
    if (item.Active == false) {
        this.FindControlInCollection("TrueOrFalse", 
            this.VidContentItems.ElementAt(index)).SetBinding(?????????);
    }
    index++;
  }

或者也许我完全错了......

4

1 回答 1

0

OK i solved it like this: I created a table where was just one image item and i add a control image viewer to the grid of the target table, then i made loop and if the value was false i hided the control.. looks easy but this wasnt possible when i was trying to put there just image control, becouse visibility couldnt be changed for specific control , only for all controls...that stacked me a lot..never use image control!!!

partial void VidContentItemsGrid_Activated() {
  int index = 0;
  foreach (var item in this.VidContentItems) {
    if (item.Active == false) {
      this.FindControlInCollection("TrueIconInd", this.VidContentItems.ElementAt(index)).IsVisible = false;
    }
    index++;
  }
}
于 2013-03-07T15:28:58.250 回答