zoukankan      html  css  js  c++  java
  • LookUpEdit How update binding source immediately after selection?

    解決辦法:

    ctDropInput1.AaaLookUpEdit1.DataBindings[0].WriteValue();
    ctTxtHid1.CtTxtCommon1.TextEdit1.DataBindings[0].WriteValue();
    ctTxtHidOperator1.CtTxtCommon1.TextEdit1.DataBindings[0].WriteValue();

    --------------------------------------------------

    from:http://www.devexpress.com/Support/Center/p/Q319769.aspx

    Dear support team!
    I feel very stupid to bother you with this. I have read other threads, but I am not sure how they solve my problem:
    I have on LookUpEdit control on a Winforms form. It is bound to one field of a datasource.
    Desired behavior: When the user selects an item, I want the LookUpEdit to close and update the bindingsource. But I just don't get it.
    I have tried to handle the EditValue_Changing event, but I do not know how to force the Update.
    This should not be too hard. What do I overlook?
    Greetings
    Marc
    -----------------------------------------------
    Ted (DevExpress Support) 2 years ago

    Hi Marc,

    Yes, when the EditValueChanged is raised the binding engine usually doesn't have enough time to update a bound data source. So, you can simply wrap code in the EditValueChanged in the BeginInvoke method. This will postpone the code execution after the binding engine does its job. Another way it to set the DataSourceUpdateMode to "Never" and manually update the value using the Binding's WriteValue method in the EditValueChanged event handler.

    Thanks,
    Ted
    -----------------------------------------------
    Thanks Ted. This should help me. Thanks a lot.
    -----------------------------------------------
    from:http://www.devexpress.com/Support/Center/p/Q251024.aspx

            Hello,

            I have a simple data binding:

                
            [C#]Open in popup window
            this.textEdit.DataBindings.Add(
                new Binding(
                    "EditValue",
                    anyBusinessObject,
                    "PropertyName",
                    true,
                    DataSourceUpdateMode.OnPropertyChanged));

            I also attach an event hanlder to the EditValueChanged event:

                
            [C#]Open in popup window
            this.textEdit.EditValueChanged += this.TextEdit_EditValueChanged;

            At the time when the event handler gets called, the value of the bound business object property still has the old value.

                
            [C#]Open in popup window
            private void TextEdit_EditValueChanged(object sender, EventArgs e)
            {
                // here the value is not updated yet:
                    // businessObject.AnyProperty != textEdit.EditValue
            }

            How can I force the data binding, that the business object property is already updated at this time? To use directly textEdit.EditValue is not an option in this case.

            Thanks for help, best regards
            Michael

    0
    Svetlana (DevExpress Support) 3 years ago

    Hi Michael,

    Thank you for the message.

    Please try to call the PropertyManager.EndCurrentEdit method in the TextEdit.EditValueChanged event handler:

        
    [C#]Open in popup window
    private void TextEdit_EditValueChanged(object sender, EventArgs e) {
              PropertyManager manager = BindingContext[businessObject] as PropertyManager;
              manager.EndCurrentEdit();
              Text = businessObject.AnyProperty.ToString();
     }

    Please try this approach, and let me know your results.

    Thanks,
    Svetlana
    0
    3 years ago

    Hi Svetlana,

    generally your solution works, except the first time the value in the text box is changed, what could that be?

    Thanks & best regards,
    Michael
    0
    Svetlana (DevExpress Support) 3 years ago

    Hi Michael,

    Thank you for the feedback.

    Please try to use the Binding.WriteValue method to immediately refresh the property's value:

        
    [C#]Open in popup window
    private void TextEdit_EditValueChanged(object sender, EventArgs e) {
              PropertyManager manager = BindingContext[businessObject] as PropertyManager;
              if(manager.Bindings.Count != 0)
                    manager.Bindings[0].WriteValue();
              Text = businessObject.AnyProperty.ToString();
      }

    Does this solution work for you?

    Thanks,
    Svetlana
    0
    3 years ago

    Hi Svetlana,

    Thanks, this solution was the key to solve my problems.

    Best regards,
    Michael
    0
    Svetlana (DevExpress Support) 3 years ago

    Hi Michael,

    Please don't hesitate to contact us in case of any difficulty. We will be happy to help you resolve any problem!

    Thanks,
    Svetlana

  • 相关阅读:
    ERROR Function not available to this responsibility.Change responsibilities or contact your System Administrator.
    After Upgrade To Release 12.1.3 Users Receive "Function Not Available To This Responsibility" Error While Selecting Sub Menus Under Diagnostics (Doc ID 1200743.1)
    产品设计中先熟练使用铅笔 不要依赖Axure
    12.1.2: How to Modify and Enable The Configurable Home Page Delivered Via 12.1.2 (Doc ID 1061482.1)
    Reverting back to the R12.1.1 and R12.1.3 Homepage Layout
    常见Linux版本
    网口扫盲二:Mac与Phy组成原理的简单分析
    VMware 8安装苹果操作系统Mac OS X 10.7 Lion正式版
    VMware8安装MacOS 10.8
    回顾苹果操作系统Mac OS的发展历史
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2606900.html
Copyright © 2011-2022 走看看