TabRegion and IDataErrorInfo

Topics: Prism v2 - WPF 3.5
Aug 25, 2009 at 8:46 AM

Hi folks,

 I use this code to add a view to a tabregion (practicly add a new tabitem)

 

IRegion tabRegion = _regionManager.Regions[RegionNames.CommonTraineeTabRegion];

            _personalInfo = _unityContainer.Resolve<PersonalInfoUserControl>();
            _personalInfo.UnityContainer = _unityContainer;
            _personalInfo.DataContext = CurrentTrainee.NatPersonByNatPersonId;
            tabRegion.Add(_personalInfo);

The problem here is that the added view has an object that gets validated in xaml using ValidatesOnDataErrors="True", but I don't see any of the validation notification icons.

I've dealed with a problem of this kind before the simple solution was to ass <AdornerDecorator> to the tabItem, but how do I do this in Prism ?

 

Any help will be greatly apreaciated !

Thank you,

 

Aug 25, 2009 at 10:10 PM

Hi

Are you getting any errors when trying to perform the validation? Although I do not know you entire scenario, if you would like to take a look at a possible validation approach in a Prism application, you can take a look at the Reference Implementation application solution.

Validation is performed on the textboxes were the user must populate the amount of orders to buy/sell, and set the price.

I hope this is useful for you.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Aug 26, 2009 at 8:15 AM

Hi Damian, thank you for your reply

The problem is in the demo also. Here is how you reproduce it:

- open a buy see that the submit button is disabled

- type in something in the share textbox and delete it then, you will notice that a red border appears (the default error template)

- I have a custom error template (!) and I need it to appear when the form is opened so that the use sees what are the mandatory fields. I had the same issue in the normal tabitem but this solved easily by adding a AdornerDecorator like this:

 

<TabItem>
 <AdornerDecorator>
 ........
 </AdornerDecorator>
<TabItem>

Regards,

Calin,