Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
UltraTimeZoneEditor
posted

I noticed that the display name for the timezone is showed in the dropdownlist.

Is it possible to switch the control to show the standard timezone name instead.

 i.e display W. Australia instead of (GMT+08:00)Perth

  • 69832
    Offline posted

    this.ultraTimeZoneEditor1.DataFilter = new TimeZoneDataFilter( this.ultraTimeZoneEditor1 );

    private class TimeZoneDataFilter : IEditorDataFilter
    {
        private UltraTimeZoneEditor control = null;

        public TimeZoneDataFilter( UltraTimeZoneEditor control )
        {
            this.control = control;
        }

        #region IEditorDataFilter Members

        public object Convert(EditorDataFilterConvertArgs conversionArgs)
        {
            if ( conversionArgs.Direction == ConversionDirection.EditorToDisplay )
            {
                TimeZoneInfo tzi = this.control.Value as TimeZoneInfo;
                if ( tzi != null )
                {
                    conversionArgs.Handled = true;
                    return tzi.StandardName;
                }
            }

            return conversionArgs.Value;
        }

        #endregion
    }