Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
How To: Use a Converter for an UnBound field
posted
I'm using an UNBOUND field to bind to a few DATETIME fields. I want to use a custom DateTimeConverter. When I'm debugging the converter is trying to convert 'Text' to a DateTime... I tried setting the ValueToTextConverter, the binding Path of the Text property for the XamTextEditor and using the Converter property of the UnBound field directly. Any help is appreciated.
Parents
No Data
Reply
  • 69686
    posted

     Hello,

    Correct me if I am wrong, I think you are trying to bind an UNBOUND field to a DATETIME field. If this is the case, you do not need a converter to do that. There is a good example of the XamFeatureBrowser (which is installed on your computer with our products) in the section XamDataGrid -- Data Binding and Interaction -- Unbound Fields. An easy way to do this (simulate binding as XamTextEditor can edit values of types DateTime and not bother about converters) is handling the InitializeRecord and RecordUpdated events like this (both with the same code) :

    private void xamDataGrid1_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e)
            {
                if (e.Record is DataRecord)
                {
                    DataRecord dr = (DataRecord)e.Record;
                    dr.Cells["Unbound"].Value = dr.Cells["DateField"].Value;

                }
            }

    However, you can see more information about the ValueToTextConverter in our help page.

    Hope this helps,

    Alex. 

Children
No Data