Xaml c#数据表绑定文本框

Xaml c#数据表绑定文本框,c#,xaml,data-binding,C#,Xaml,Data Binding,我正在尝试将datatable的数据绑定到文本框。 它工作正常,但只显示datatable的最后一行。 是否可以显示datatable的所有行 XAML: 提前感谢,, Fluxxi这是文本框的设计方式。您应该使用列表框(或类似)控件。是的,但您需要使用某种中继器控件,如a或a。谢谢,我来看看! <Window x:Class="messenger.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/pre

我正在尝试将datatable的数据绑定到文本框。 它工作正常,但只显示datatable的最后一行。 是否可以显示datatable的所有行

XAML:

提前感谢,,
Fluxxi

这是
文本框的设计方式。您应该使用
列表框
(或类似)控件。

是的,但您需要使用某种中继器控件,如a或a。

谢谢,我来看看!
<Window x:Class="messenger.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
    <TextBox Height="203" HorizontalAlignment="Left" Name="conversationInput" VerticalAlignment="Top" Width="491" Margin="12,3,0,0" IsReadOnly="True">
        <TextBox.Text>
            <MultiBinding StringFormat="{0} : {1}">
                <Binding Path="date" />
                <Binding Path="message" />
            </MultiBinding>
        </TextBox.Text>
    </TextBox>
</Grid>
    public DataTable loadConversation()
    {
        DataTable conversation = new DataTable();
        string loadMessages = "select message, date from Messages where userID=1";
        ad = new MySqlDataAdapter(loadMessages, connection);
        ad.Fill(conversation);
        return conversation;
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        conversationInput.DataContext = loadConversation().DefaultView;
    }