嗨,美好的一天,我只是WPF和MVVM设计模式的新手,我从PRISM的BRIAN LAGUNAS先生的博客和视频中学到了很多东西..但只是想问一个noob问题..我的代码有什么问题吗doest为我工作...非常感谢任何帮助谢谢.这是我的代码:
我的观点模型
public class Person : BindableBase
{
private myPErson _MyPerson;
public myPErson MyPerson
{
get { return _MyPerson; }
set
{
SetProperty(ref _MyPerson, value);
}
}
public Person()
{
_MyPerson = new myPErson();
updateCommand = new DelegateCommand(Execute, CanExecute).ObservesProperty(() => MyPerson.FirstName).ObservesProperty(() => MyPerson.Lastname);
// updateCommand = new DelegateCommand(Execute).ObservesCanExecute((p) => CanExecute); /// JUST WANNA TRY THIS BUT DUNNO HOW
}
private bool CanExecute()
{
return !String.IsNullOrWhiteSpace(MyPerson.FirstName) && !String.IsNullOrWhiteSpace(MyPerson.Lastname);
}
private void Execute()
{
MessageBox.Show("HOLA");
}
public DelegateCommand updateCommand { get; …
Run Code Online (Sandbox Code Playgroud) 如何在不违反MVVM模式规则的情况下在WPF中打开/关闭新窗口?
我只是想模仿ms office outlook的登录模块.
我已经阅读过这篇文章,但传递参数时出错confirmation
我目前正在使用棱镜5.0.
再会,
我有一个像下面这样的模型类
public class EmployeeModel
{
[Key]
public int employeeId{get;set;}
public string Fullname {get;set;}
public string Address{get;set;}
public ICollection<PaymentModel> Payments {get;set;}
}
public class PaymentModel
{
[Key]
public int PaymentId{get; set;}
public int employeeId{get; set;}
public decimal PaymentAmount{get; set;}
public int IsPosted {get; set;}
public virtual EmployeeModel Employee {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
我只想使用 linq 查询员工列表及其付款列表。所以我这样编码:
dbcontext db = new dbcontext();
var listing = from d in db.Employees
.include("Payments")
select d;
Run Code Online (Sandbox Code Playgroud)
此列表显示所有员工及其所有付款。但我需要过滤 IsPosted = 1 的每个员工付款
所以作为最初的答案,我会做这个代码;
dbcontext db = new dbcontext(); …
Run Code Online (Sandbox Code Playgroud)