Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

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)

C#
<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>
Posted

1 solution

You might Binding a table in a FlowDocument[^] this helpful.
This[^] might help you as well.
 
Share this answer
 
Comments
sajithnet 7-Mar-12 1:43am    
many thanks Abhinav,
i have a question how can i set a property of a class to the
<TableRowGroup removed="White" DataContext="{Binding Source={StaticResource InputData}, Path=[0]}">.

Say i have a class "Text1.cs" it is having a property called name how can i set to the source

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900