如何用完资源来设置绑定 [英] How to set Binding with using out Resources

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

问题描述


我可以在不使用资源的情况下在wpf中设置绑定吗?
方案:我在


can i set binding in wpf with out using Resources.
scenario:i have a class name "Test" in

CHB.Menu.Clinical

中有一个类名"Test",它是
具有属性标题",我需要将

which is
having a Propery "Title" i need to set

"Title"

设置为binding.with out
使用(StaticResource/其他任何资源).在我发现错误的任何位置都可以.

as binding.with out
using (StaticResource/ any other resources).can any one figure where i wend wrong .

<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>

推荐答案

<textblock textwrapping="Wrap" name="Column" text="{Binding Source=local:Test, Path=Title}"></textblock>


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

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