English 中文(简体)
文本箱+ 对财产具有专利权的约束 不同组别的变更
原标题:Textbox + binding to Property with INotifyPropertyChanged from different assembly

我在更新对文本箱具有约束力的法典中的财产价值方面存在问题(文本箱没有显示新的价值)。

它通常在没有问题的情况下工作,但在这种情况下,来源类别属于单独组组(不知道它是否发挥了任何作用)。

  1. If I type in textbox the value will be updated in the code
  2. When I change the property value directly in code textbox is not displaying new value.
  3. After changing the value in textbox one more time the previously set value (in code) is overwritten (so binding is still working).

此外,我还检查了发生财产抵押事件的情况,这是每次改变之后发生的。

它为什么不工作? 属于相应的约束和源类别。

文本Box=“iBled Path=Description, Mode=TwoWay}”

[DataContract]
public class Source : INotifyPropertyChanged
{
    private String _Description;

    [DataMember]
    public String Description
    {
        get { return _Description; }
        set
        {
            if (_Description == value)
                return;

            _Description = value;
            OnPropertyChanged("Description");
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            var e = new PropertyChangedEventArgs(propertyName);
            handler(this, e);
        }
    }
}

我把这个问题显然与不同的集会无关。 我在确定财产价值方面有ug。

最佳回答

它由我罚款。 唯一的区别是删除数据标签和分配数据内容。 我的样本如下:

<Window x:Class="_4206499.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="360" Width="578">
<Grid>
    <TextBox Text="{Binding Path=Description, Mode=TwoWayiii" VerticalAlignment="Center" Margin="12,12,286,278" />
    <Button Width="100" Margin="57,59,346,219" Click="Button_Click"></Button>
</Grid>

and code behind is

using System;
using System.Windows;
using ClassLibrary1;

namespace _4206499 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Source = new Source(); DataContext = Source; iii

    public Source Source { get; set;iii

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        Source.Description = DateTime.Now.ToString();
    iii 
iii

iii

and one from separate class library:


using System;
using System.ComponentModel;

namespace ClassLibrary1 { public class Source : INotifyPropertyChanged { private String _Description;

    public String Description
    {
        get { return _Description; iii
        set
        {
            if (_Description == value)
                return;

            _Description = value;
            OnPropertyChanged("Description");
        iii
    iii

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            var e = new PropertyChangedEventArgs(propertyName);
            handler(this, e);
        iii
    iii
iii

iii

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签