Hello,
I want to use the IDataErrorInfo interface and the xamdatagrid to show invalid records (rows) not cells. So basically if any business rules are violated, the object's IsValid will be false. When the objects IsValid is false, I want the grid to put a red border around the row. I do NOT want each cell border to be red, but rather I want the whole row to have a red border.
Is there a way to do this?
Thanks,
Jeff
Hello Jeff,
I have been looking into this and even though there is no built-in functionality I was able to modify the original template of the DataRecordPresenter, so you can achieve the desired result. What I had to do was to add a border around the whole record and check the HasDataError property to visualize it. I have put all this in a sample project for you (Grid_IDataError_row_border.zip) and have added comments in the xaml in capital letters only for your reference.
Please let me know if you require any further clarification on the matter.
Petar,
While that does seem to do the trick, it throws an exception in the Visual Studio designer (at least in mine). When I try to view the view in the designer it says "NullReferenceException was thrown on "ControlTemplate": Object reference not set to an instance of an object."
I included a screenshot so you can see it.
If we can clear that up, then I think it will work out for me!!
Thanks for the help!
-Jeff
I see what you mean I also get the same designer error in Visual Studio, however this is not because there is some flaw in the Style itself, but rather due to the fact that Visual Studio is not designer oriented environment and has trouble resolving complex resource relations in design time. If you run this under Expression Blend there is no such issue. I have even modified the sample so it creates the data xaml and in Expression Blend you can even see the number of rows and their IDataError colouring. All this with no design time errors:
I have also uploaded the updated project for your reference (Grid_IDataError_row_border_modified.zip).
I just d/l your project and will check it out. I have a case open with support about the designer errors. I'll continue that outside of this thread. Thanks for the help!!
Just to be clear though, I don't have this designer limitation with any intrinsic controls or other 3rd party controls that I have styled so far. If the IG controls cripple my IDE just because I need to style them, then I see that as a HUGE disadvantage to using IG controls. I use my VS IDE for a lot of things and rely on the designer for parts of that. Just my thoughts, but I have to consider that going forward....
Hi Jeff,
I do see what you mean however this in not exactly crippling the IDE. Also I am not saying that this cannot be done otherwise, however when creating lots of independent parts as styles, templates that provide, localization theming there are cases that the designer must be sacrificed for the sake of integrating runtime functionalities. Other cases are when something works good in runtime it isn’t always a good idea to turn it headfirst for the sake of the designer, especially when in Blend designers can still manage. I am not sure if in this particular case we are seeing one of the above mentioned issues and if this is indeed important it can be sent to the XamDataGrid developers for their assessment on the matter.
Please let me know if I can help with anything else on the matter.
I disagree and here is why. There are those on my development team who are not "graphics inclined". They don't use blend because many times their task only entails setting up some bindings, or clicking on a control and setting properties in the properties window. The problem is, now that I used an IG control and styled it, they are forced to work directly in Xaml or learn a new tool. And it doesnt end there, because even if they used blend, many times properties are just displayed in random order in the misc tab of the blend IDE so it's actually harder to find things that are plain to get to in the VS properties window.
Maybe I should not have used the term crippled IDE, but it certainly cripples the designer in the IDE.
I do understand what you mean that sometimes to give a good user experience you do things in such an advanced way that VS doesnt deal with it, and perhaps that is a Microsoft issue. Afterall, no style that compiles should crash the designer, if anything, it should just not interpret things it cant understand (as long as they are valid and compile) .
In the end I think it would be nice to use the designer from Blend in the VS IDE at least for rendering purposes, but until (or if) that happens, I think you guys might want to look at this from 10,000 feet. Using IG controls with styles breaks the VS IDE. There needs to be a workaround from my perspective as other controls just don't give me this problem.
Just my thoughts!!
Thanks for following up. I appreciate the follow-up!!
I have logged this with development, for their assessment on the matter, under ID: 113175 and I have also created a support ticket on your behalf: CAS-91478-YNCG0F and have linked the development issue to it, so that you can get automatically updated, when a Service Release containing the fix is available for download. You can get the new version from our website’s “My IG”, “My Keys & Downloads” tags: https://ko.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
You can also monitor the support ticket’s progress through the “My Support Activity” tag: https://ko.infragistics.com/Membership/MySupport.aspx
I do understand that and even though I cannot promise this is going to be fixed, I am going ot contact our development team on your behalf to see if they can shed some light on this particular issue.
I will update you when I make any progress in resolving this.