XAML Code:

<ListBox Margin="0,40,0,0" Grid.Row="1">

        <ListBox.ItemTemplate>

              <DataTemplate/>

        </ListBox.ItemTemplate>

</ListBox>

有人问我:以上这段代码使用Blend 2.0在设计界面,如何设置出来?SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

这是需要费点事的。我在此把图贴出来,如果你也遇到的问题,你也可以参考一下吗?

 

Step 1.选中ListBox,在属性----杂项---ItemTemplate

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

Step 2.选择数据绑定

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

Step 3.添加CLR对象,创建DataTemplate

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

Step 4.已经有代码生成看出来 ItemTemplate="{Binding Mode=OneWay ....}"

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

Step 5.再次选择ItemTemplate,选择转换为本地值

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

Step 6.OK,Over

SilverLight Topic---如何在Blend 2.0中设置ListBox.ItemTemplate?

 

(当然对于开发人员肯定不会这样周折的!,那如果你不是开发人员呢?)

 

不过我在使用Blend做界面,还是感觉有时不如直接写代码快啊。

相关文章:

  • 2021-11-22
  • 2021-06-15
  • 2022-02-02
  • 2021-12-27
  • 2021-11-10
  • 2021-11-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2021-05-31
  • 2022-01-31
  • 2021-10-14
  • 2021-11-20
  • 2022-02-15
相关资源
相似解决方案