如何在WPF中为表设置绑定 [英] How to set Binding for Table in wpf

查看:56
本文介绍了如何在WPF中为表设置绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



可以共享一个示例来演示表中列的绑定吗?
我已经完成了一个样本,但是无法正常工作,我不知道如何设置来源
iam附加了代码.我需要将源设置为staticresource(textfile/xml)



Can some one share a sample for demonstration the binding of column in Table
i have done one sample but it is not working i doesn''t know how to set the source
iam attaching the code.i need to set source as staticresource(either textfile/xml)

<UserControl x:Class="CHB.Cardio.Custom.FreeStyle"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" >
           
    <Table Name="ItemsTable" CellSpacing="10" BorderBrush="Black" BorderThickness="2" TextAlignment="Justify">
        <Table.Columns>
            <TableColumn Width="320"/>
            <TableColumn Width="320"/>
             </Table.Columns>
        <TableRowGroup removed="White" DataContext="{Binding Source={StaticResource InputData}, Path=[0]}">
            <TableRow>
                <TableCell>
                    <Paragraph>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Path=Columns[0]}"/>
                    </Paragraph>
                </TableCell>
                <TableCell>
                    <Paragraph>
                        <TextBlock TextWrapping="Wrap" Text="{Binding Path=Columns[1]}"/>
                    </Paragraph>
                </TableCell>
            </TableRow>
        </TableRowGroup>
    </Table>

</UserControl>

推荐答案

您可能绑定表在FlowDocument中 [ ^ ]这很有帮助.
[ ^ ]可能对您也有帮助.
You might Binding a table in a FlowDocument[^] this helpful.
This[^] might help you as well.


这篇关于如何在WPF中为表设置绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆