小编Ble*_*ter的帖子

如何更改x的默认模式:绑定?

我不知道为什么他们决定为设置默认值ModeOneTime但是,这不是我想要的大部分时间.我浪费了一整天的调试时间.

有没有一种方法来设置OneWay值作为默认Modex:Bind

<!--This will not listen to future changes. it is OneTime by default-->
<TextBlock Text="{x:Bind Name}"/>

<!--We have to explicitly define Mode value-->
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
Run Code Online (Sandbox Code Playgroud)

xaml windows-10 uwp xbind

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

如何用基类初始化继承的类?

我有这个类的一个实例:

public class MyClass
{
    public string Username { get; set; }
    public string Password { get; set; }

    public string GetJson()
    {
        return JsonConvert.SerializeObject(this);
    }
}
Run Code Online (Sandbox Code Playgroud)

但在某些情况下,我需要序列化json中的更多属性.我以为我应该像这样创建第二个继承的类:

public class MyInheritedClass : MyClass
{
    public string Email { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

如果我没有以错误的方式解决问题,我如何使用第一个类的实例初始化我的第二个类的新实例并且从中GetJson()包含所有三个属性的json字符串?

c# inheritance

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

UWP如何绑定到两个值?

我有一个DownloadModel包含两个属性.我想在一个单独的节目中显示这两个属性的摘要TextBlock

<TextBlock Text="{x:Bind DownloadModel.Part1.Progress, Mode=OneWay}"/>
Run Code Online (Sandbox Code Playgroud)

有没有办法通过Download.Part1.Progress,Download.Part2.Progress然后一起显示两者的摘要TextBlock

(如果有可能这样做Binding而不是x:Bind那样也会好的) 谢谢.

c# xaml windows-10 uwp

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

如何检查应用程序安装的第一个日期?

我有一个付费应用程序,想在 Store 中免费提供几天。但只针对那些在这些特殊日子安装它的人,我想展示广告。

如何检查用户是否在特定时间范围内安装了应用程序?

我想到了这些解决方案:

  • 我可以在以前的包裹中签个名并在这个包裹中检查它。如果它不可用,这是第一次安装。
  • 自第一次安装后,我可以保存日期。

但是现在这些都行不通了。

谢谢。

c# windows-store-apps uwp

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

无法加载文件或程序集或其依赖项之一。

我知道这被问了很多,但我尝试了所有解决方案但没有奏效!

这是在调试模式下运行时的错误:

System.IO.FileLoadException: '无法加载文件或程序集 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)'

我试图消除所有binobj文件夹的所有projects在我的solution。还删除了Packages文件夹。

还删除了所有配置文件中的此项:

<dependentAssembly>
    <assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

也将newVersion上面代码中的值更改为4.0.0.0但绝不喜欢工作!

当我卸载项目并对其进行编辑时,我看到这一行:

<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?提前致谢。

c# visual-studio nuget

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

如何订购列表的项目并删除基于属性的重复项?

我是这堂课:

public class User
{
    public long Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Username { get; set; }

    public int Contributions { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

List<User>可以包含多个具有相同Id但不同Contributions值的项目.

我希望有基于的不同值Id,但具有最高Contributions价值Id.我怎样才能做到这一点?谢谢.

我试过这个,但它只是我想要的一部分:

list.OrderByDescending(x => x.Contributions);
Run Code Online (Sandbox Code Playgroud)

c# linq

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