简体   繁体   English

如何在Blend中将枚举与单选按钮绑定?

[英]How to Bind Enum with a radio Button in Blend ?

I have two projects in my solution. 我的解决方案中有两个项目。 One is WPF and another one is ClassLibrary. 一个是WPF,另一个是ClassLibrary。 In my Class Library project I have an Enum and I bound it to my View in WPF project as Static Resources. 在我的类库项目中,我有一个枚举,并将其作为静态资源绑定到WPF项目中的View。

My Code Is : 我的代码是:

namespace DPOS.Core.Helpers
{
   public enum SearchOptions
   {
       SingleDate,
       DateRange,
       Name,
       Amount,
       Quantity,
       All
   }
}

xmlns:helpers="clr-namespace:DPOS.Core.Helpers;assembly=DPOS.Core"


RadioButton x:Name="RadioSingleDate" Content="{Binding SingleDateContent}" 
Margin="0,21.54,0,0" TabIndex="2" VerticalAlignment="Top" Style="{DynamicResource RadioButtonStyle}"
IsChecked="{Binding SearchOptions, ConverterParameter={x:Static helpers:SearchOptions.SingleDate}, Converter={StaticResource EnumToBooleanConverter}}"/>

This work`s file in Visual Studio 2012. But Problem is when I Open it in Blend (Blend for Visual studio) then it say : 此工作文件在Visual Studio 2012中。但是问题是,当我在Blend(Visual Studio混合)中打开它时,它说:

The name "SearchOptions" does not exist in the namespace "clr-namespace:DPOS.Core.Helpers;assembly=DPOS.Core" 名称“ SearchOptions”在命名空间“ clr-namespace:DPOS.Core.Helpers; assembly = DPOS.Core”中不存在

I don`t understand what is happening. 我不明白发生了什么事。

Am I Missing something? 我想念什么吗?

我通过使用Blend重新添加我的ClassLibrary项目引用来解决我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM