WPF data validation is overriding theme on the interface

Posted by black sensei on Stack Overflow See other posts from Stack Overflow or by black sensei
Published on 2010-06-02T17:39:06Z Indexed on 2010/06/02 18:54 UTC
Read the original article Hit count: 455

Filed under:
|
|
|

Hello! Good People

I built a WPF application and manage to get the validation working thanks to posts on stackoverflow.The only probblem i'm having is that it's overriding the theme i'm using. example the theme makes the textboxes look like a round rectangle but after setting the binding it look like the default textboxes. here is my code :

<Button.Style>
            <Style TargetType="{x:Type Button}">
                <Setter Property="IsEnabled" Value="false" />
                <Style.Triggers>
            <!-- Require the controls to be valid in order to press OK -->
            <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding ElementName=txtEmail, Path=(Validation.HasError)}" Value="false" />

                        </MultiDataTrigger.Conditions>
                        <Setter Property="IsEnabled" Value="true" />
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
        </Button.Style>

code behind is :

//Form loaded event code
txtEmail.GetBindingExpression(TextBox.TextProperty).UpdateSource();

I've tried to look into the theme file but i was quickly lost.i thought i could use that file like a web css file.Now i've disabled the data binding because of that.Is there any work around for this? thanks for reading this

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf