【发布时间】:2016-05-27 07:40:20
【问题描述】:
我遇到了 WPF 控件的问题,我正在像这样实现它
<UserControl x:Class="VizarisUpdater.Page.SetupPage"
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:VizarisUpdater.Converters"
mc:Ignorable="d"
d:DesignHeight="390" d:DesignWidth="692">
在页面后面
<Label Grid.Row="2" Grid.Column="1">
<TextBlock Text = "{Binding Path=SpaceRequired, StringFormat='Space Required: {0}', Converter={local:NumberToBestSizeConverter}}" FontSize="20" VerticalAlignment="Center"/>
</Label>
当我移除转换器时,它会显示数字 ok(没有转换),但是当我添加转换器时,它就消失了。我也有智能感知告诉我:
The name "NumberToBestSizeConverter" does not exists in the namespace "clr-namespace:VizarisUpdater.Converters"
我在项目中定义了 .net Framework 4.0。有什么想法吗?
【问题讨论】:
-
转换器使用示例:stackoverflow.com/questions/2304269/…,stackoverflow.com/questions/5166705/…;绑定需要一个转换器实例
-
感谢朋友的示例,感谢。