在WPF中绑定时获取集属性会发生什么? [英] What happens in Get Set Property while Binding in WPF ?

查看:61
本文介绍了在WPF中绑定时获取集属性会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是WPF的新手,任何人都可以解释以下关于问题和程序的设置属性,



1)为什么我们要分配私人和公共,

2)get和set关键字的用途是什么,

3)我们返回的价值是多少得到,

4)为什么我们使用价值,

5)RaisePropertyChanged的使用是什么()

6)什么是xamal文件和cs文件之间的链接通过在xamal文件中指定Text ={Binding Path = FirstName}



Hi,

I am new to WPF can anyone explain get set property regarding below questions and program,

1)why we are assigning private and public,
2)what is the use of get and set keyword,
3)what value we are returning in get,
4)why we are using "value",
5)what is the use of RaisePropertyChanged()
6)What is the link between xamal file and cs file by assigning Text="{Binding Path=FirstName}" in xamal file

public class Person
{
    public string FirstName { get; set; }
} 

public class MainViewModel : ViewModelBase
{
  private const string FirstNamePropertyName = "FirstName";
    public string FirstName
    {
        get
        {
            return _newPerson.FirstName;
        }
        set
        {
            _newPerson.FirstName = value;
            RaisePropertyChanged(FirstNamePropertyName);
        }
    }
}













提前致谢...

R.Karthik







Thanks in advance...
R.Karthik

推荐答案

1.为什么我们要分配私有和公共

PUBLIC-类型或成员可以被同一程序集中的任何其他代码或引用的另一个程序集访问它。

PRIVATE-

类型或成员只能通过同一类或结构中的代码访问。



2)get和set关键字有什么用?

3)我们返回的值是多少?


答案。 。

http://msdn.microsoft。 com / en-in / library / aa287786(v = vs.71).aspx



5)RaisePropertyChanged的用途是什么( )?


最安全的使用方式RaisePropertyC绞死方法


这篇关于在WPF中绑定时获取集属性会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆