wpf中的数据绑定与asp.net中的转发器相同

时间:2013-01-16 14:27:09

标签: wpf

我在asp.net中有这样的转发器

 <asp:Repeater runat="server" ID="rptrExperience" OnItemDataBound = "itembound">
                        <ItemTemplate>
                            <div class="experience">
                               <a><asp:Label ID="Label13" class="accounts-link" runat="server" Text='<%#Eval("JobTitle") %>'></asp:Label></a> <br />
                               <a> <asp:Label ID="Label14" class="accounts-link" runat="server" Text='<%#Eval("Company") %>'></asp:Label></a><br />
                                <%-- <asp:Label ID="Label1" runat="server" Text='<%#Eval("town") %>'></asp:Label><br />
                                <asp:Label ID="Label15" runat="server" Text='<%#Eval("Location") %>'></asp:Label><br />--%>
                                <asp:Label ID="Label16" runat="server" Text='<%#Eval("Period") %>'></asp:Label><br />
                                <asp:Label ID="Label17" runat="server" Text='<%#Eval("Description") %>'></asp:Label><br />
                                <asp:Label ID="lblname" runat="server"></asp:Label>
                                <a id="ae" href="#?w=750" class=" floatleft poplight"  rel="popup6" runat ="server"  >Endorse <asp:Label ID="en" runat="server" Text='<%#Name(Eval("UserId")) %>'></asp:Label>'s Work in <asp:Label ID="en1" runat="server" Text='<%#Eval("Company") %>'></asp:Label></a>
                                <a  id="te" runat="server" rel="tooltip" title="You can endorse your collegue or friend you have worked together.This is your professional opinion so keep it professional.Tip: Keep it clear and simple, Your friend can delete your endorsementif they are innappropriate. "><img src="images/icon-tips.png" width="14" height="15" alt="tips" /></a>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>

使用linq绑定数据

我希望在wpf应用程序中显示相同内容。我是wpf的新手,任何人都可以帮助我

1 个答案:

答案 0 :(得分:1)

我认为ItemsControl可能符合您的需求:

<ItemsControl ItemsSource="{Binding ...}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <!-- Template goes here ... -->
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>