Click here to Skip to main content
15,910,009 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: New to XAML Pin
Xmen Real 23-Feb-08 15:29
professional Xmen Real 23-Feb-08 15:29 
GeneralRe: New to XAML Pin
Christian Graus23-Feb-08 15:54
protectorChristian Graus23-Feb-08 15:54 
GeneralRe: New to XAML Pin
Xmen Real 23-Feb-08 15:56
professional Xmen Real 23-Feb-08 15:56 
GeneralRe: New to XAML Pin
Christian Graus23-Feb-08 23:03
protectorChristian Graus23-Feb-08 23:03 
GeneralRe: New to XAML Pin
Xmen Real 23-Feb-08 23:31
professional Xmen Real 23-Feb-08 23:31 
GeneralRe: New to XAML [modified] Pin
Xmen Real 23-Feb-08 16:23
professional Xmen Real 23-Feb-08 16:23 
Generaltextbox validation Pin
angels77722-Feb-08 20:28
angels77722-Feb-08 20:28 
GeneralRe: textbox validation Pin
User 27100923-Feb-08 1:59
User 27100923-Feb-08 1:59 
I just posted an article on this.

http://www.codeproject.com/KB/WPF/WPFBusinessAppsPartTwo.aspx[^]

Download the code and look at the resource dictionaries in the Skins folder.

Basically you need to set up a control template. I have placed the following markup at application scope.

The markup will render a * to the left of the TextBox is there is a validation error.

XML
<ControlTemplate x:Key="validationTemplate">
    <DockPanel>
        <TextBlock Margin="5,0,5,0" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" Text="*" />
                         <AdornedElementPlaceholder />
                    </DockPanel>
</ControlTemplate>

<Style TargetType="{x:Type TextBox}">
    <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource validationTemplate}" />
    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="true">
            <Setter Property="ToolTip" Value="{Binding Path=(Validation.Errors)[0].ErrorContent, 
                RelativeSource={x:Static RelativeSource.Self}}" />
        </Trigger>
    </Style.Triggers>
</Style>


This should get you going. Please read the article, it will really help in this situation.

Cheers, Karl

» CodeProject 2008 MVP

My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your Articles

Just a grain of sand on the worlds beaches.



modified 27-Feb-21 21:01pm.

GeneralRe: textbox validation Pin
angels77723-Feb-08 7:10
angels77723-Feb-08 7:10 
GeneralRe: textbox validation Pin
User 27100923-Feb-08 9:12
User 27100923-Feb-08 9:12 
GeneralRe: textbox validation Pin
angels77723-Feb-08 13:26
angels77723-Feb-08 13:26 
GeneralRe: textbox validation Pin
User 27100923-Feb-08 15:29
User 27100923-Feb-08 15:29 
General3D text Pin
Yoyosch21-Feb-08 22:13
Yoyosch21-Feb-08 22:13 
GeneralRe: 3D text Pin
User 27100922-Feb-08 2:00
User 27100922-Feb-08 2:00 
GeneralRe: 3D text Pin
Yoyosch24-Feb-08 21:37
Yoyosch24-Feb-08 21:37 
GeneralRe: 3D text Pin
User 27100925-Feb-08 0:40
User 27100925-Feb-08 0:40 
QuestionSecurity exception when increasing maxReceivedMessageSize for XBAP [modified] Pin
Hashen20-Feb-08 21:25
Hashen20-Feb-08 21:25 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100921-Feb-08 15:32
User 27100921-Feb-08 15:32 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen21-Feb-08 20:10
Hashen21-Feb-08 20:10 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100922-Feb-08 1:57
User 27100922-Feb-08 1:57 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen24-Feb-08 22:13
Hashen24-Feb-08 22:13 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100925-Feb-08 0:32
User 27100925-Feb-08 0:32 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen25-Feb-08 1:53
Hashen25-Feb-08 1:53 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100925-Feb-08 13:19
User 27100925-Feb-08 13:19 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Stephen4226-Mar-08 23:19
Stephen4226-Mar-08 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.