小编ele*_*eep的帖子

停止突出显示所选项目WPF ComboBox

我正在开发一个WPF用户界面,我的窗口上有一个组合框.所以我希望用户能够从这个组合框中选择一个项目但是当它被选中时我不希望它以默认的蓝色突出显示.

我假设有一些方法可以在XAML中阻止它,但到目前为止我还没有找到解决方案.

谢谢.

PS我无法访问Expression Blend,所以如果有人建议解决方案可以在XAML中

编辑:只是为了让我更清楚我选择了我的意思是一旦你选择了一个值并且SelectionChanged事件被触发并且项目显示在组合框中,组合框被突出显示如下: 替代文字

.net c# wpf combobox wpf-controls

3
推荐指数
1
解决办法
6726
查看次数

弹性搜索短语搜索

我有一个弹性搜索文档,看起来像......

{
    "items":
    [
        "ONE BLAH BLAH BLAH TWO BLAH BLAH BLAH THREE",
        "FOUR BLAH BLAH BLAH FIVE BLAH BLAH BLAH SIX"
    ]
}
Run Code Online (Sandbox Code Playgroud)

我希望能够使用短语查询来搜索此文档,例如...

{
    "match_phrase" : {
        "items" : "ONE TWO THREE"
    }
}
Run Code Online (Sandbox Code Playgroud)

因此,无论中间的单词如何,它都将匹配.这些词也需要按顺序排列.我意识到这可以通过slop属性来实现,但是当我进行实验的时候,它似乎包裹起来,如果斜率不仅仅是我在搜索之间的单词,而且这是一个不确定的单词我不喜欢认为slop是合适的.另外我只需搜索数组中的每个项目,所以...

{
    "match_phrase" : {
        "items" : "ONE TWO SIX"
    }
}
Run Code Online (Sandbox Code Playgroud)

如在本文件不会匹配SIX是在该阵列中不同的项目ONETWO.

所以我的问题是,这可能是通过elasticsearch还是我必须创建一个对象数组并使用嵌套查询来搜索它们?

search json full-text-search nosql elasticsearch

3
推荐指数
1
解决办法
3230
查看次数

从EWS访问Outlook用户属性

我正在尝试创建一个使用EWS api访问联系人的应用程序.

我需要在这个过程中查看一个outlook用户属性,但我不知道如何使用EWS.我刚试过的那一刻......

service.Url = new Uri("https://url/ews/Exchange.asmx");
service.Credentials = new WebCredentials("credentials");
var results = service.FindItems(folderId, new ItemView(100));
foreach (var item in results)
{
     Contact contact = item as Contact;
     foreach (var prop in contact.ExtendedProperties)
     {
            Console.WriteLine(prop.Value.ToString());
     }
}
Run Code Online (Sandbox Code Playgroud)

哪个编译并执行没有问题,但对于每个联系人,ExtendedProperties计数为0,在outlook中约为30.

那么我怎样才能获得我正在寻找的属性?

只是一个FYI.我正在使用exhcnage 2007.

谢谢.

c# outlook exchange-server-2007 exchangewebservices

2
推荐指数
1
解决办法
3221
查看次数

无法在web.config中为WCF服务设置授权规则

我在帖子中读到,您可以在Web配置中使用ASP.Net授权来控制对WCF Web服务的访问,以替换以下属性:

[PrincipalPermission(SecurityAction.Demand, Role="Administrators")]
Run Code Online (Sandbox Code Playgroud)

为了测试我一直在使用"管理员",这是一个有效的角色,所以应该允许我访问和"测试",这不是.这在使用上述属性时工作正常但是当我将其注释掉并在我的Web.Config文件中使用它时:

<authentication mode="Windows" />
<authorization>
  <allow roles=".\TEST"/>
  <deny roles="*"/>
</authorization>
Run Code Online (Sandbox Code Playgroud)

它仍然允许我访问.

所以我想知道我是否在web.config中遇到了错误,或者我读到的内容是否错误说使用它.

仅供参考,这是我看过的帖子:

在带有WCF的App.config中使用Windows角色身份验证

以下是我的web.config:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Windows" />
    <authorization>
      <allow roles=".\TEST"/>
      <deny users="*"/>
    </authorization>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WcfService1.ServiceBehaviour1" name="WcfService1.Service1">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding"
                  name="BasicHttpEndpoint" contract="WcfService1.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService1.ServiceBehaviour1">
          <!-- To avoid disclosing metadata information, set the …
Run Code Online (Sandbox Code Playgroud)

.net asp.net wcf authorization web-config

1
推荐指数
1
解决办法
5700
查看次数

自动滚动到跨度元素

我有一个包含(惊喜!)一篇文章的元素。

页面顶部有一个标签列表,可以在文章中找到。当用户单击标签时,文章中的任何匹配词都会突出显示。

我遇到的问题是自动滚动到突出显示的单词。

有没有办法用 javascript/jQuery 做到这一点?

以下是我查找单词并突出显示它的代码:

$(".article-tags a.toggle").live("click", function () {
        var $this = $(this);
        var $p = $this.closest("p");
        if ($p.find("span.highlight").length == 0) {
            $("#viewer .article-body").highlight($this.text());
            $this.highlight($this.text());
            document.getElementById("viewer").scrollTop = $p.find("span.highlight").offsetTop;
        }
        else {
            $("#viewer .article-body").removeHighlight();
            $p.removeHighlight();
        }
        return false;
    });
Run Code Online (Sandbox Code Playgroud)

谢谢。

html javascript jquery

0
推荐指数
1
解决办法
4741
查看次数