<Application.Resources>
        
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles\Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:TSmallHelper.Converter">
    
    <local:TemperatureValueConverter x:Key="mTemperatureValueConverter"/>
    <UserControl x:Class="TSmallHelper.Views.Index"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/up-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="118" Width="215" Background="{Binding Path=TodayTemperature,Converter={StaticResource mTemperatureValueConverter}}">
这是声明步骤,但是调试打断点,没法进TemperatureValueConverter,而且这个Converter 没有起任何作用,请问这是怎么回事?

解决方案 »

  1.   

    Path=TodayTemperature能证明这有效吗?
      

  2.   

    [ValueConversion(typeof(string), typeof(SolidColorBrush))]
        public class TemperatureValueConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                SolidColorBrush mySolidColorBrush = new SolidColorBrush();
                mySolidColorBrush.Color = Color.FromArgb(255, 0xF0, 0x96, 0x09);            return mySolidColorBrush;
            }        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
      

  3.   

    有效是什么意思?你在 TodayTemperature 属性中设置断点,在调试器上,它能中断吗?
      

  4.   

    有效是什么意思?你在 TodayTemperature 属性中设置断点,在调试器上,它能中断吗?
    刚试了,不能中断,这是什么原因?之前用没遇到过这种原因。