Facebook Twitter Gplus LinkedIn YouTube Google Maps RSS
Home Technical Silverlight DatePicker with Date Only
formats

Silverlight DatePicker with Date Only

Published on June 30, 2010 by in Technical

using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace Ravi.UI.Silverlight
{
///

/// Custom date picker control to override standard
/// date picker behavior
///

public class DatePicker : System.Windows.Controls.DatePicker
{
///

/// set the text to null if it is invalid
///

/// protected override void OnDateValidationError(DatePickerDateValidationErrorEventArgs e)
{
this.Text = this.SelectedDate == null ? null : this.SelectedDate.ToString();
base.OnDateValidationError(e);
}

///

/// Setting the DataPicker TextBox to 10 Characters only.
///

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
DatePickerTextBox datePickerTextBox = base.GetTemplateChild(“TextBox”) as DatePickerTextBox;
if (datePickerTextBox != null)
datePickerTextBox.MaxLength = 10;

}
}
}

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

12,873 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© All rights reserved to Cyberbrutus. 2012
credit

Switch to our mobile site