Example #1
0
        /// <summary>
        /// Handles the property changed event for address elements.
        /// </summary>
        /// <param name="d">AddressLabel whose address has changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnAddressChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue != e.NewValue)
            {
                AddressLabel addressLabel = d as AddressLabel;

                if (addressLabel != null)
                {
                    addressLabel.UpdateInlineAddress();
                }

                if (e.Property == PostcodeProperty)
                {
                    addressLabel.canChangePostcodeDisplayValue = true;
                    string postcode = e.NewValue as string;
                    if (string.IsNullOrEmpty(postcode))
                    {
                        addressLabel.SetValue(AddressLabel.PostcodeDisplayValueProperty, string.Empty);
                    }
                    else
                    {
                        addressLabel.SetValue(AddressLabel.PostcodeDisplayValueProperty, postcode.ToUpper(CultureInfo.CurrentCulture));
                    }

                    addressLabel.canChangePostcodeDisplayValue = false;
                }

                addressLabel.UpdateElementsVisibility();
            }
        }
Example #2
0
        /// <summary>
        /// Handles the property changed event for InlineAddressDisplayText.
        /// </summary>
        /// <param name="d">AddressLabel whose InlineAddressDisplayText has changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnInlineAddressDisplayTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AddressLabel addressLabel = d as AddressLabel;

            if (addressLabel != null && !addressLabel.canChangeInlineAddressDisplayValue)
            {
                addressLabel.canChangeInlineAddressDisplayValue = true;
                addressLabel.SetValue(e.Property, e.OldValue);
                addressLabel.canChangeInlineAddressDisplayValue = false;
                throw new InvalidOperationException("Property is readonly");
            }
        }
Example #3
0
        /// <summary>
        /// Handles the property changed event for address part visibility.
        /// </summary>
        /// <param name="d">AddressLabel whose address part visibility has changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnAddressPartVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AddressLabel addressLabel = d as AddressLabel;

            if (addressLabel != null && !addressLabel.canChangeAddressPartVisibility)
            {
                addressLabel.canChangeAddressPartVisibility = true;
                addressLabel.SetValue(e.Property, e.OldValue);
                addressLabel.canChangeAddressPartVisibility = false;
                throw new InvalidOperationException("Property is readonly");
            }
        }
Example #4
0
        /// <summary>
        /// Handles the property changed event for address display format.
        /// </summary>
        /// <param name="d">AddressLabel whose address has changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnAddressDisplayFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue != e.NewValue)
            {
                AddressLabel addressLabel = d as AddressLabel;

                if (addressLabel != null)
                {
                    addressLabel.ShowAddress();
                }
            }
        }
 /// <summary>
 /// Creates a new instance of address label automation peer.
 /// </summary>
 /// <param name="control">Address label control.</param>
 public AddressLabelAutomationPeer(AddressLabel control)
     : base(control)
 {
 }
 /// <summary>
 /// Creates a new instance of address label automation peer.
 /// </summary>
 /// <param name="control">Address label control.</param>
 public AddressLabelAutomationPeer(AddressLabel control)
     : base(control)
 {
 }