Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • jm-fp

    jm-fp

    Member

    2 Points

    1 Post

    Re: Looking for your feedback on Input controls

    Feb 20, 2009 01:52 AM | LINK

    Hey Mark,

    The error reminder control can be used for any Silverlight controls. Simply set the TargetControl and IsOpen properties:

      

      <TextBox x:Name="textBox1" Width="150" Height="22" TextChanged="textBox1_TextChanged" />
     
      public partial class Page : UserControl
    {
    private FpErrorReminder reminder;

    public Page()
    {
    InitializeComponent();

    this.reminder = new FpErrorReminder();
    this.reminder.TargetControl = this.textBox1;
    // the description will appear in the mouse-hover tool-tip
    this.reminder.ErrorDescription = "Upper case letter is not allowed";
    }

    private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
    {
    // the reminder shows up when the text contains upper-case letter
    this.reminder.IsOpen = Regex.IsMatch(textBox1.Text, "[A-Z]");
    }
    }

      

    It is easier for FpErrorReminder to work with other Input Pro controls. You can show the reminder when the control value is out of the range defined by Max/MinValue:

      

    <InputPro:FpDouble Width="180" Height="22" MinValue="0" MaxValue="100" ValueUpdateMode="Immediate">
    <InputPro:ErrorReminderService.ErrorReminder>
    <InputPro:FpErrorReminder ErrorDescription="Value out of range" />
    </InputPro:ErrorReminderService.ErrorReminder>
    </InputPro:FpDouble>

     

    Or you can show a piece of text as the reminder:

     

    <InputPro:FpDouble Width="180" Height="22" MinValue="0" MaxValue="100" ValueUpdateMode="Immediate"
    InputPro:ErrorReminderService.ErrorReminder="Value out of range" />
     

    The ErrorReminderService class reads the IsValid property of Input Pro controls and shows an error reminder when it is false.

    Thanks,

    Jimmy

    input controls Error Provider Error reminder Input Pro