Converter on a Field

This post has 19 Replies | 7 Followers

sbowe
Points 160
Replied On: Thu, May 1 2008 5:45 PM

According to the online documentaion there is a Converter property on a Field in a XamDataGrid.

http://help.infragistics.com/Help/NetAdvantage/WPF/2007.2/CLR3.X/html/Infragistics3.Wpf.DataPresenter.v7.2~Infragistics.Windows.DataPresenter.Field~Converter.html 

This property does not appear in the xaml when I attempt to use it. Am I doing something wrong? What I am trying to do is create a Y/N to True False so it can be used by a checkbox in my datagrid. I saw a couple examples that provided a new template with a checkbox inside it but I really dont want to use that approach unless I am forced too. Here is what I have so far. I just need a way to convert my 'Y' or 'N' value to check or uncheck the box.

<igDP:Field Name="COL_NAME" Label="Blah">
 <igDP:Field.Settings>
  <igDP:FieldSettings EditAsType="{x:Type sys:Boolean}"/>
 </igDP:Field.Settings>
</igDP:Field>

Thanks

  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Fri, May 2 2008 10:01 AM

You need to create a convert class that implements IConverter and then instantiate it in a resources section of your xaml. You can then reference that instance in a binding.

Here is a good introduction:

http://learnwpf.com/Posts/Post.aspx?postId=05229e33-fcd4-44d5-9982-a002f2250a64

 

  • Post Points: 20
sbowe
Points 160
Replied On: Fri, May 2 2008 10:27 AM

I already have the converter created and have used it many times. The problem I have is where do I use it in a binding in the infragistics grid? Generally I would use it exactly like the sample you linked too. I just can't find a way to use it on the Grid Column. As I said in my original post they have a converter property listed in the docs but I don't see it in the actual code.

So how can I tell a certain Field which converter to use?

  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Mon, May 5 2008 4:08 PM

I guess I don't understand. Here's a very simple example of a converter in my code.

<igDP:Field Name="ElapsedDays"

Label="Elapsed"

Converter="{StaticResource ElapsedDaysToStringConverter}" />

  • Post Points: 35
sbowe
Points 160
Replied On: Tue, May 6 2008 10:54 AM

Thank you for your response. That is exactly what I want to do but when I use that code I get this error.

The property 'Converter' does not exist in XML namespace 'clr-namespace:Infragistics.Windows.DataPresenter;assembly=Infragistics3.Wpf.DataPresenter.v7.2'.

I am using a trial version. The version number from the dll is 7.2.20072.1000. Is this property introduced in a later version, do I need the full version?

Thanks again.

  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Tue, May 6 2008 11:13 AM

Hmmm... that is strange. I know for a fact that the trial version supports this because I used it before upgrading to the full version. I'm not sure what to tell you.

Maybe you could try browsing into the library from vs. If I drill down into Infragistics3.WPF.DataPresenter.v7.2 and then Infragistics.Windows.DataPresenter and then click on the Field class, on the right I see the properties and methods for the Field.

What do you see in that list? There's no Converter?

I think your top level namespace will be a little different because of the trial.

  • Post Points: 35
sbowe
Points 160
Replied On: Tue, May 6 2008 11:48 AM

I browsed into the libray by using "Go To Definition". The resulting screenshot is attached. I also looked at the assembly through Reflector and that property did not exist.

I'm glad to know this will be easy to do if I can get the correct version of the dll's. I attempted to download the latest hotfix but apparently that is only available to paying subscribers. Since we are still in "evaluation" mode that is not an option right now.

Thanks for your help on this.


  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Tue, May 6 2008 12:03 PM

I never tried uploading a screenshot. Cool.

Try this in the object browser. I'd like to see how "close" we are ... is it just this one property missing? Or is something bigger going on here?

Attached is a screenshot from my end, browsing into the Express dll, which is what you have.


  • Post Points: 20
sbowe
Points 160
Replied On: Tue, May 6 2008 12:36 PM

You can't see from my screenshot but I am not using the Express version. I am getting this from the Infragistics3.WPF.DataPresenter.v7.2 assembly. As you can see Converter is still not there. It looks pretty similar other than that.


  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Tue, May 6 2008 12:58 PM

That's awesome. It's just plain old missing.

I got confused about "trial" versus "express". I thought you were using the express.

Gee, I don't know what that could be. I hate to sound predictable, but have you tried uninstalling/reinstalling?

You could also install the express version (they seem to be able to live together in harmony) and see if THAT has it. If it does, maybe you could prove the product with THAT and then upgrade to the full later. Maybe something's screwy with the trial version? I forget how the install works ... if the trial is the same as the full, without a key, or if it's a seperate build...

  • Post Points: 50
sbowe
Points 160
Replied On: Tue, May 6 2008 2:06 PM

I installed the Express version and Converter was not in there either. I then applied the 1007 hotfix to the express version and the Converter property finally appeared.

If anyone from Infragistics is listening (which doesn't seem likely) it would be awesome if I could download the hotfix for the non-express trial version.

Thanks for all your help with this issue.

  • Post Points: 20
tbeaulieu
Points 3,627
Replied On: Tue, May 6 2008 2:13 PM

That is really strange. I was using converters with the express version and pretty much finished my proto app with it. I actually delivered the first version using express. I then upgraded to the full version and applied the hot fix. I can't make sense of your experience.

This secretive hot fix is really a bad idea all the way around. It really doesn't make sense and surely impacts customer experience and satisfaction. With Wpf being so new, I'd think it important to establish a strong user base and reputation. Support is a huge part of the buying decision, and is the reason I didn't go with Xceed.

 

  • Post Points: 5
klauswiesel
Points 60
Replied On: Tue, Jun 10 2008 6:15 AM

Hello

As I use a datatable as itemssource for my grid, I cannot define fields in xaml

How can I apply the converter by code (vb)?

Regards

Klaus

  • Post Points: 20
Replied On: Tue, Jun 17 2008 7:58 PM

 Hi Klaus,

 

There's a Converter property on the Field. After you bind to the data table, you can access the field using something along the lines of

 dp.FieldLayouts[0].Fields["FieldName"].Converter = converter;

 

Hope this helps,

Sandip 


  • Post Points: 35
priyalatha
Points 88
Replied On: Sun, Jun 22 2008 10:25 PM

Hi,

I am using FieldLayoutSettings and I do not have FieldSetting for individual columns in my XamGrid. How can I use Converter? I want to convert specific string to brush.

How can I include this converter in my FieldlayoutSettings?

I need this urgently ..plz help.

Thanks,

priyalatha

  • Post Points: 20
Page 1 of 2 (20 items) 1 2 Next > | RSS