This is a migrated thread and some comments may be shown as answers.

Wizard like PanelBar validation.

1 Answer 11 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 28 Jul 2010, 08:46 PM
hi, I try to do a small wizard for creating a new address. I got an entity (EF) address that a instantiate at the beginning of the wizard:
NouvAdresse = new Adresse();

On the first page wizard (each step are in different RadpanelItem). I got 4 textbox binded to the Adresse entity like:
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding wizAjouteAdresseRes.lblDestinataire, Source={StaticResource ResourceWrapper}}" HorizontalAlignment="Right" VerticalAlignment="Top"></TextBlock>

The validation present in the EF metadata work well. But if a textbox can't be empty and the user do not enter any value For example he just do a tab over it), the validation do not occur because the text are not changed.

To avoid that I create a function called in the Click event of the button to force the validation of all the currently wizard section:

private void ForceValidation(Grid Container)
{
      
    foreach(var ctrl in Container.Children)
    {
        if (ctrl is TextBox)
        {
            (ctrl as TextBox).GetBindingExpression(TextBox.TextProperty).UpdateSource();
        }
    }
}

That work, but how I can detect if no validation error as been raise for let the user go to next step? For now the user change step either with validation error.
The user will click on the Next button, then forced validation occurd and if all is ok the panel change..
Any suggestion?

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 02 Aug 2010, 12:41 PM
Hello Pierre,

You can attach to GotFocus and LostFocus events of the TextBox and force the validation from there. Have a look at this MSDN article on explicit validation. Once you are done with that, you can read this StackOverflow thread as it explains one possible way to handle and detect validation errors in Silverlight. Let me know if these help.

Kind regards,
Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
PanelBar
Asked by
Pierre
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or