Ejemplo n.º 1
0
        protected virtual void CountryControl_Leaving(object sender, WPFUserControl.AutoCompleteTextBoxControlEventArgs e)
        {
            // if area control is ready only, only area of the assigned country can be selected
            if (AreaControl.ListBoxReadOnly)
            {
                RefreshControl((e.Object as Country)?.Areas?.OfType <Location>().ToList(), AreaControl);
            }
            // otherwise all existing areas can be selected (or new onces can be entered)
            else
            {
                RefreshControl(_allAreas.OfType <Location>().ToList(), AreaControl);
            }

            // clear old text
            SubAreaControl.ClearText();
            SubjectLocationControl.ClearText();
            SubjectLocationLatitudeControl.Text  = null;
            SubjectLocationLongitudeControl.Text = null;

            // derived class can set the view model property
            // take country name from country object (if in database) or from UI text
            SetCountryDisplayItem(e.Object as Country != null ? (e.Object as Country).Name : CountryControl.GetCurrentText());

            // set focus to the respective text box
            AreaControl.SetFocus();
        }
Ejemplo n.º 2
0
 protected virtual void SubAreaControl_LeavingViaShift(object sender, WPFUserControl.AutoCompleteTextBoxControlEventArgs e)
 {
     AreaControl.SetFocus();
 }