小编Gri*_*ory的帖子

如何在WPF ListView中获取光标下的Item

如何在ListView中获取光标下的项目?

例如,当我移动鼠标光标时,我希望得到一个项目(光标)并将其名称放到状态栏.

实际上我需要在WinForms.NET中使用类似GetItemAt(int x,int y)的方法

谢谢!

UPD:找到了答案.观看下面的扩展方法

wpf listview

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

您的项目未引用".NETPortable,Version = v4.5,Profile = Profile78"

当我构建我的PCL项目时,我收到以下错误:

Microsoft.NuGet.targets(186, 5): [null] Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile78" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile78" in the "frameworks" section of your project.json, and then re-run NuGet restore.

msbuild .net-standard

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

WPF中的菜单访问键

我有一个带指定访问键的经典菜单.

问题:使用按Alt+ E(编辑菜单),然后按住Alt他按下F.他希望选择子菜单Edit - > Form,而是打开上级菜单File.

如果他发布Alt- 一切都会好的.

同时Visual Studio在这种情况下表现得非常正确.

有任何想法吗 ?

谢谢!

upd: 我觉得VS使用AccessKeyManager作用域.

wpf menu shortcut

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

避免任务和任务的重复方法<T>

我有一些逻辑TaskTask<T>.有没有办法避免重复代码?

我目前的代码如下:

public async Task<SocialNetworkUserInfo> GetMe()
{
    return await WrapException(() => new SocialNetworkUserInfo());
}

public async Task AuthenticateAsync()
{
    await WrapException(() => _facebook.Authenticate());
}

public async Task<T> WrapException<T>(Func<Task<T>> task)
{
    try
    {
        return await task();
    }
    catch (FacebookNoInternetException ex)
    {
        throw new NoResponseException(ex.Message, ex, true);
    }
    catch (FacebookException ex)
    {
        throw new SocialNetworkException("Social network call failed", ex);
    }
}

public async Task WrapException(Func<Task> task)
{
    try
    {
        await task();
    }
    catch (FacebookNoInternetException ex)
    {
        throw new …
Run Code Online (Sandbox Code Playgroud)

.net c# task

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

在Dlang中传递函数指针

我正在尝试使用Dlang运行OpenGL示例.

void onError(int code, const(char)* text) nothrow
{
}
Run Code Online (Sandbox Code Playgroud)

用法:

glfwSetErrorCallback(&onError);
Run Code Online (Sandbox Code Playgroud)

绑定代码:

__gshared {

    da_glfwSetErrorCallback glfwSetErrorCallback;

    ...

extern( C ) @    nogc nothrow {

    alias da_glfwSetErrorCallback = GLFWerrorfun function( GLFWerrorfun );

    ...

    alias GLFWerrorfun = void function( int, const( char )* );
Run Code Online (Sandbox Code Playgroud)

我得到以下编译器错误:

Error: function pointer glfwSetErrorCallback (extern (C) void function(int, const(char)*) nothrow) is not callable using argument types (void function(int code, const(char)* text) nothrow)
Run Code Online (Sandbox Code Playgroud)

编译:2.065.0

d function

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

如何在Universal Windows Platform应用程序中更新一个特定的dotnet程序集?

我读到dotnet是OpenSource,并通过nuget而不是monolith安装程序通过粒度包分发.

我创建了一个简单的UWP应用程序,我在project.json中看到的是

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试通过nuget安装预发布System.Collections我得到以下

Version conflict detected for System.Private.Uri. 
 SM.W10 (? 1.0.0) -> System.Collections (? 4.0.11-beta-23516) -> System.Runtime (? 4.0.21-beta-23516) -> System.Private.Uri (? 4.0.1-beta-23516) 
 SM.W10 (? 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (? 5.0.0) -> Microsoft.NETCore.Runtime (? 1.0.0) -> Microsoft.NETCore.Runtime.CoreCLR-arm (? 1.0.0) -> System.Private.Uri (= 4.0.0).
Run Code Online (Sandbox Code Playgroud)

我觉得我应该以某种方式展开,Microsoft.NETCore.UniversalWindowsPlatform但它有很多级别的嵌套,只有深度嵌套Microsoft.NETCore.Runtime.CoreCLR-arm有严格版本的System.Private.Url

有没有办法更新System.Collections没有痛苦?

.net nuget windows-10 .net-core uwp

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

标签 统计

.net ×2

wpf ×2

.net-core ×1

.net-standard ×1

c# ×1

d ×1

function ×1

listview ×1

menu ×1

msbuild ×1

nuget ×1

shortcut ×1

task ×1

uwp ×1

windows-10 ×1