Click here to Skip to main content
15,916,378 members
Home / Discussions / WPF
   

WPF

 
QuestionIssue with binding and ValidationRules Pin
Rohde9-Jan-09 23:24
Rohde9-Jan-09 23:24 
I have a problem with ValidationRules. Basically the data binding works, but the Validate-method of the ValidationRules never fire.

This is part of my XAML (ZoomDialogBox.xaml):

<StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
            <Label>Factor:</Label>
            <TextBox Name="FactorTextBox" Width="30" Margin="10,0,0,0">
                <TextBox.Text>
                    <Binding Path="." UpdateSourceTrigger="PropertyChanged">
                        <Binding.ValidationRules>
                            <validators:ZoomFactorValidationRule MinZoomFactor="1" MaxZoomFactor="20" />
                        </Binding.ValidationRules>                        
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </StackPanel>


This is the property I am binding to, and this binding works (from ZoomDialogBox.cs):

public int ZoomFactor
        {
            get
            {
                return (int) this.DataContext;
            }

            set
            {
                this.DataContext = value;
            }
        }


As said, the binding works, but the ValidationRules is never applied. What am I doing wrong here?



"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."

-Atlas Shrugged, Ayn Rand

AnswerRe: Issue with binding and ValidationRules Pin
User 27100910-Jan-09 15:02
User 27100910-Jan-09 15:02 
GeneralRe: Issue with binding and ValidationRules Pin
Rohde10-Jan-09 15:34
Rohde10-Jan-09 15:34 
AnswerRe: Issue with binding and ValidationRules Pin
User 27100910-Jan-09 15:41
User 27100910-Jan-09 15:41 
GeneralRe: Issue with binding and ValidationRules Pin
Rohde10-Jan-09 15:47
Rohde10-Jan-09 15:47 
GeneralRe: Issue with binding and ValidationRules Pin
User 27100910-Jan-09 15:48
User 27100910-Jan-09 15:48 
QuestionSilverlight problem in IIS Pin
CrazyCoder269-Jan-09 20:29
CrazyCoder269-Jan-09 20:29 
AnswerRe: Silverlight problem in IIS Pin
Mohammad Dayyan20-Jan-09 19:57
Mohammad Dayyan20-Jan-09 19:57 
AnswerRe: Silverlight problem in IIS Pin
Michael Sync29-Jan-09 2:32
Michael Sync29-Jan-09 2:32 
Question.NET MEMORY Profiler undisposed Instances Pin
ezazazel9-Jan-09 3:55
ezazazel9-Jan-09 3:55 
AnswerRe: .NET MEMORY Profiler undisposed Instances Pin
User 27100910-Jan-09 15:11
User 27100910-Jan-09 15:11 
GeneralRe: .NET MEMORY Profiler undisposed Instances Pin
ezazazel11-Jan-09 0:18
ezazazel11-Jan-09 0:18 
GeneralRe: .NET MEMORY Profiler undisposed Instances Pin
User 27100911-Jan-09 1:50
User 27100911-Jan-09 1:50 
GeneralRe: .NET MEMORY Profiler undisposed Instances Pin
ezazazel11-Jan-09 2:33
ezazazel11-Jan-09 2:33 
GeneralRe: .NET MEMORY Profiler undisposed Instances Pin
User 27100911-Jan-09 2:35
User 27100911-Jan-09 2:35 
GeneralRe: .NET MEMORY Profiler undisposed Instances Pin
Potapov A9-Mar-09 8:48
Potapov A9-Mar-09 8:48 
QuestionCustomize Collection Editor Item Pin
Vinod C S9-Jan-09 3:45
Vinod C S9-Jan-09 3:45 
AnswerRe: Customize Collection Editor Item Pin
User 27100910-Jan-09 15:14
User 27100910-Jan-09 15:14 
AnswerRe: Customize Collection Editor Item Pin
User 27100911-Jan-09 6:16
User 27100911-Jan-09 6:16 
QuestionConfigurable Image Rotator needs code review Pin
johnsontroye9-Jan-09 3:40
johnsontroye9-Jan-09 3:40 
QuestionWPF Multiple Projects Resource Dictionary Pin
Bex_30009-Jan-09 3:25
Bex_30009-Jan-09 3:25 
AnswerRe: WPF Multiple Projects Resource Dictionary Pin
Jammer9-Jan-09 3:59
Jammer9-Jan-09 3:59 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Bex_30009-Jan-09 4:10
Bex_30009-Jan-09 4:10 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Jammer9-Jan-09 4:32
Jammer9-Jan-09 4:32 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Jammer9-Jan-09 4:51
Jammer9-Jan-09 4:51 

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.