现在的位置: 首页 > 综合 > 正文

添加本地类命名空间到xaml文件

2012年07月29日 ⁄ 综合 ⁄ 共 368字 ⁄ 字号 评论关闭

xmlns:local="clr-namespace:你的命名空间"

local 可以随便改 比如 my

比如你的类 实现了IValueConverter接口

调用:

定义key

    <Grid.Resources>
           <local:DateFormatter x:Key="FormatConverter" />
        </Grid.Resources>

 

调用

  <TextBlock Text="{Binding Path=ReleaseDate, Mode=OneWay,
                        Converter={StaticResource FormatConverter}, 
                        ConverterParameter=\{0:d\}}"
 />

抱歉!评论已关闭.