【问题标题】:ItemsSource in WPF Declaritively into C# ProgrammaticallyWPF 中的 ItemsSource 以编程方式以声明方式转换为 C#
【发布时间】:2009-04-23 14:12:42
【问题描述】:

快速提问,如何将其转换为后端代码?即c#

ItemsSource="{Binding Source={StaticResource List1}, XPath=Entry}"

【问题讨论】:

    标签: c# xaml


    【解决方案1】:
    Binding items = new Binding();
    items.Source = FindResource("List1");
    items.XPath = "Entry";
    myItemsControl.SetBinding(ItemsControl.ItemsSourceProperty, items);
    

    其中myItemsControl 是要设置ItemsSource 的控件。

    【讨论】:

    • 我假设 Entry 元素/节点将包含一组子元素?
    猜你喜欢
    • 2013-01-21
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多