Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
can i set binding in wpf with out using Resources.
scenario:i have a class name "Test" in
CHB.Menu.Clinical
which is
having a Propery "Title" i need to set
"Title"
as binding.with out
using (StaticResource/ any other resources).can any one figure where i wend wrong .

C#
<Table  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/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:CHB.Menu.Clinical"> //here iam setting to local

    <Table.Columns>
    <Table.Columns>
        <TableColumn Width="340"/>
        <TableColumn Width="340"/>
    </Table.Columns>
    <TableRowGroup>
        <TableRow FontFamily="MS Sans Serif" FontWeight="Bold" FontSize="20" Foreground="#FFFFFFFF" removed="#FF6495ED">
            <TableCell  TextAlignment="Center" LineHeight="30" ColumnSpan="2">
                <BlockUIContainer>
                    <TextBlock TextWrapping="Wrap" Name="Column" Text="{Binding Source=local:XPSReport:FreestyleSection, Path=Title}"></TextBlock>
                </BlockUIContainer>
            </TableCell>
        </TableRow>
    </TableRowGroup>
</Table>
Posted
Updated 7-Mar-12 5:25am
v2

1 solution

<textblock textwrapping="Wrap" name="Column" text="{Binding Source=local:Test, Path=Title}"></textblock>
 
Share this answer
 
v2
Comments
sajithnet 8-Mar-12 22:50pm    
thank you SpringLo,
what i was missing is to set datacontext for Tablerowgroup.when i set this it work fine.


<Table 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/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CHB.SCAMPS.Clinical;assembly=CHB.SCAMPS.Clinical">
<Table.Columns>
<TableColumn Width="340"/>
<TableColumn Width="340"/>
</Table.Columns>
<TableRowGroup>
<TableRowGroup.DataContext>
<local:freestylesection>
</TableRowGroup.DataContext>
<TableRow FontFamily="MS Sans Serif" FontWeight="Bold" FontSize="20" Foreground="#FFFFFFFF" Background="#FF6495ED">
<TableCell TextAlignment="Center" LineHeight="30" ColumnSpan="2">
<blockuicontainer>
<textblock textwrapping="Wrap" name="Column" text="{Binding Title,Mode=OneWay}">

</TableCell>
</TableRow>
</TableRowGroup>
</Table>
Regards,
sajith

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