locked
Error Validation - AutoCompleteBox doesn't have red borders RRS feed

  • Question

  • When validation errors occur on my modal window the red outline appears on textbox and datepicker controls. If lightswitch does this by default for those controls then why not for the auto complete box? If I need to write custom XAML just to get a red border I'm not even going to waste my time on it. I just need to know if there is some special setting for AutoCompleteBoxes I'm not aware of. Here is a simple example:

    Entity Person

    Name - String -Textbox

    Birthday - Date - DatePicker

    Gender - Integer - AutoCompleteBox (Male = 100, Female = 101)

    When any of these fields are not set the proper errors (3) are displayed in the validation summary. However only the two controls (textbox and DatePicker) are outlined in red. Is there something I am missing here?


    • Edited by Maggie0010 Tuesday, June 25, 2013 2:47 PM
    Tuesday, June 25, 2013 2:38 PM

Answers

  • I have finally figured this out.

    To anyone else experiencing this issue.

    When the AutoCompleteBox refers to another entity there are two properties. In the above example, there is an Integer property that you can display on a form or the much more desired relationship property.

    The difference is:

    results.AddPropertyError("Gender must be populated!");

    refers to the wrong property where...

    results.AddPropertyError("Gender must be populated!", this.Details.Properties.Gender);

    Properly identifies the correct place to put the red outlines.

    • Marked as answer by Maggie0010 Tuesday, June 25, 2013 3:15 PM
    Tuesday, June 25, 2013 3:15 PM

All replies

  • I have finally figured this out.

    To anyone else experiencing this issue.

    When the AutoCompleteBox refers to another entity there are two properties. In the above example, there is an Integer property that you can display on a form or the much more desired relationship property.

    The difference is:

    results.AddPropertyError("Gender must be populated!");

    refers to the wrong property where...

    results.AddPropertyError("Gender must be populated!", this.Details.Properties.Gender);

    Properly identifies the correct place to put the red outlines.

    • Marked as answer by Maggie0010 Tuesday, June 25, 2013 3:15 PM
    Tuesday, June 25, 2013 3:15 PM
  • Hi,

    I am very glad that you have solved your problem by yourself.

    If you have any other problem, welcome to post it to the Visual Studio LightSwitch Forums.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 26, 2013 10:20 AM
    Moderator