I found recently than the Validation Error Adorners on my WPF Project when used within a Tab Control, would disappear if I changed tabs.

After a little searching, I found this helpful post;

http://karlshifflett.wordpress.com/2008/02/19/wpf-validation-errors-disappear-inside-tabcontrol-when-switching-tabitems/

You basically need to wrap your Tab Control Tab Content within a Adorner Decorator as follows;

[fusion_builder_container hundred_percent=”yes” overflow=”visible”][fusion_builder_row][fusion_builder_column type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”no” center_content=”no” min_height=”none”]

<Border>      
    <AdornerDecorator>            
        <StackPanel>                  
            ...           
        </StackPanel>      
    </AdornerDecorator>
</Border>

This “bug” is due to the fact that the Error Adorners are painted on the Adorner Layer, which is discarded when changing tabs. The code above preserves this layer, preventing the Adorners from being lost.[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

By | 2017-07-24T08:33:19+00:00 December 22nd, 2012|.Net Framework, Bugs, WPF|0 Comments

About the Author:

Leave A Comment