ResourceDictionary中的WP7转换器

时间:2012-01-31 11:32:42

标签: windows-phone-7 resourcedictionary

在页面上,我们将转换器声明为

<phone:PhoneApplicationPage.Resources>
   <local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
</phone:PhoneApplicationPage.Resources>

如何在ResourceDictionary中声明它?

2 个答案:

答案 0 :(得分:3)

  

如何在ResourceDictionary中声明它?

<local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>

答案 1 :(得分:1)

在App.xaml

中添加此项
  <Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary>
               <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            </ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
     </ResourceDictionary>
  </Application.Resources>