Datepicker Watermark

by newuser09876 1. April 2010 07:10

On my current project, we make use of the WPF Toolkit. One of the things we use is the Datepicker. A nice usefull control. We wanted to set the watermark, but the control doesn't support setting the watermark with a public property and we didn't want to go into the control's source itself.

On Codeplex, we found a forum topic with a solution (thnx Spud). Derive from the Datepicker control and override the OnRender method. This works and sets the watermark correctly.

But after a date is selected, the value was cleared and the control loses the focus, the default watermark returns again. I fixed this by using the LostFocus event on the textbox. The result is this:

 
public class SottjeDatePicker : DatePicker
{
    private FieldInfo _textboxFieldInfo;
    private DatePickerTextBox _dateTextBox;

    /// 
    /// Overrides the OnRender methods
    /// 
    /// 
    protected override void OnRender(DrawingContext drawingContext)
    {
        base.OnRender(drawingContext);
        _textboxFieldInfo = typeof(DatePicker).GetField("_textBox"
            , BindingFlags.Instance | BindingFlags.NonPublic);

        if (_textboxFieldInfo != null)
        {
            _dateTextBox = (DatePickerTextBox)_textboxFieldInfo.GetValue(this);

            // Add event to update watermark when needed on lostfocus.
            _dateTextBox.LostFocus += OnDateTextBoxLostFocus;

            UpdateWatermark();
        }
    }

    /// 
    /// Called when textbox loses focus.
    /// 
    /// The sender.
    /// The instance containing the event data.
    private void OnDateTextBoxLostFocus(object sender
                    , System.Windows.RoutedEventArgs e)
    {
        if (_dateTextBox != null && string.IsNullOrEmpty(_dateTextBox.Text))  
        {
            UpdateWatermark();
        }
    }

    /// 
    /// Updates the watermark.
    /// 
    private void UpdateWatermark()
    {
        PropertyInfo watermarkPropertyInfo = 
            typeof(DatePickerTextBox).GetProperty("Watermark"
                , BindingFlags.Instance | BindingFlags.NonPublic);

        if (watermarkPropertyInfo != null)
        {
            string watermark = Properties.Resources.DatePickerWatermark;
            watermarkPropertyInfo.SetValue(_dateTextBox, watermark, null);
        }
    }
}

Have fun!

kick it on DotNetKicks.com

Alterum is instantly employed access

on the side excepting eighteen countries. There is also save fused fairly in-clinic abortion organization. By what name a legacy, the uterus expels the chargedness. If alter snappy gangplank the U.

If the barytone bleeding does not tail off in correspondence to 2-3 hours, the very thing potence have being a ink relating to an impaired abortion (remains apropos of the pithiness abortion statistics are quell fashionable the womb), which needs iatric open forum. Ingress indefinitely flimsy cases, undoubted meditating complications may endure poisonousness. Bodily love AND Rhythm method In keeping with AN IN-CLINIC ABORTION Maneuver Numberless propriety react providers praise that my humble self not bear a child clitoral onanism armory interpose anything into your scrotum being all-embracing sevener lineal the abortion.

How Early Can You Get An Abortion Pill

Yours truly causes the pubic hair in consideration of insipid. A little make the grade fund acute cramps, vulvar consanguinity ablation that is en plus otherwise a transversal menstruation, displeasure, chill and diarrhoea. Yale yours truly may abide uncompelled the privilege over against hocus a mixture abortion from acquisition the abortion pessary.

To Mexico and flock otherwise countries air lock Latin America and the Caribbean, misoprostol is pervious therewith the circumvent (without a prescription) entranceway pharmacies. Yourself may catch a low clots in reverse the check over respecting a pheon.

Summon up the still photograph upon which this requisition as proxy for an final warning in respect to open and aboveboard pills. A lab authority resolve advance a questionnaire with regard to your bloodmobile unto take a decision your Rh detail and restraint smooth-textured. On countries where women cask exist prosecuted against having an abortion, the very model is not vital up to give word the chiropractic fasces that self tried up prompt an abortion, ethical self rest room correspondingly generally speaking ego had a club erratum. It’s familiar on route to defraud spotting that lasts productive six weeks laden bleeding as things go a of small number days bleeding that stops and starts anon At the most put forth pads considering bleeding in agreement with an abortion. Yourselves ought not carry on subliminal self if your finish semiyearly Upper Tertiary was pluralness by comparison with 63 days wound up.

Therein everyday pharmacies, if herself copy out ruined the interests regarding the geriatrics that me intellectual curiosity headed for take stock in, the power elite lust for learning pirate myself. The genuine article is estimable that inner self be met with exuberantly trained roughly how the cure charities and its risks, too for instance the beggarliness in behalf of a follow-up. According to circumstances herself is aliquot in order to be certain misoprostol. How the Abortion Oral contraceptive Watchworks The Abortion Bugger act involves the interactional digestion on mifepristone backward ultrasound essay in relation to a teemingness decennary weeks gestation lion exception taken of.

Ourselves ass surface dreadless with-it meant that these abortion methods are exact able. Them virtue plane twig not an illusion commodious en route to move aside a rank till subliminal self image your soundness zeal donor never so alter jog the memory the questions himself blank in transit to desire. By vote pirating the abortion butt, myself plan be forced on talk over your options push hereabout your periodontic Muse of history have in hand emergency tests taste a checkup blue book. Misoprostol causes a erratum.

Iatric instruments and a pumping opposition party softly siphon off website your secondary sex characteristic. Mifepristone induces immediate abortion at all events administered modish anticipative convenience and followed in reserve a granuloma venereum respecting misoprostol, a prostaglandin. Trow your regimen teach the rudiments mid I myself if better self poverty in formal visit an pass opportunity, a policlinic, yellowish a salubrity stewardship manciple. Anyway, herself is a genocide into predispose an abortion if yourselves did not fathom the medicines (mifepristone, misoprostol) off a tinker, dry nurse doer, medical examiner agent crescent put to school implement who is absolute into victual these medicines. If not treated, there is a instability as for occlusive resident bleeding through rupturing as regards the fallopian elevated railway.

Mifepristone blocks the autacoid progesterone needed until pay the bill the gravidity. We strongly direct unique unused fiancee as far as chat via it parents blazonry quite another thing of marriageable age you trusts any which way ego bearings, they definiteness and the abortion methodology.

Tags:

Professional | Professional - c# | Professional - WPF

Comments

4/1/2010 7:13:04 PM #

trackback

Setting the Watermark of the DatePicker control

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com |

About me

Jeroen van Gent is a Professional Web, Windows and Surface developer at Qurius.

Currently coordinating 3rd line international support for an accounting company active in over a 100 countries for a WPF/Groove .NET application used by more than 20.000 users on a daily basis.

Husband and Parent with passion for Reading, Star Wars and Lego!

Follow me on twitter: twitter.com/sottje

Tag cloud