Ticket S30920
Visible to All Users

How to display a tooltip/hint for an editor, its caption/column header, and other elements

created 16 years ago

Hello,
The current version of XAF does not allow you to set up tooltips for the editors. For now, you may only set the tooltips for edtors at runtime. You should create a new ViewController, access the required PropertyEditors, obtain the actual editors and setup their tooltips property values:
    public class SetToolTipsViewController : ViewController {
        public SetToolTipsViewController()
            : base() {
            this.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView;
        }
        protected override void OnActivated() {
            this.View.ControlsCreated += new EventHandler(View_ControlsCreated);
        }
        protected override void OnDeactivating() {
            this.View.ControlsCreated -= new EventHandler(View_ControlsCreated);
        }
        void View_ControlsCreated(object sender, EventArgs e) {
            DetailView view = (DetailView)View;
            for(int i = 0;i < view.Items.Length;i++)
                ((BaseEdit)view.Items[i].Control).ToolTip = view.Items[i].Caption;
        }
    }
Thanks,
Dan

Show previous comments (22)
Dennis Garavsky (DevExpress) 12 years ago

    @James: The stuff I discussed above will be available in 12.2 only.

      Thanks Dennis for your information! I'll try this new feature after two months :)

      CR CR
      Chris Royle (LOBS) 11 years ago

        @Dennis - thanks :)

        Answers

        created 12 years ago (modified 8 years ago)

        Starting with v12.2, you can specify a new ToolTip property at the Class member (IModelMember), ListView column (IModelColumn), DetailView item, navigation & layout group (IModelLayoutGroup ) and item levels in the application model. Note that once set for a class member, the tooltip value is automatically calculated for below layers such as ListView column, DetailView item, layout group and item, unless the user has already set a tooltip at these levels.
        For more convenience, you can use the new ToolTipAttribute  to set tooltip options in the code of your business class.
        Take special note that additional tooltip settings such as ToolTipTitle and ToolTipIconType have effect for WinForms applications in DetailView only.
        Note: At the moment, tooltips with rich content (e.g., HTML formatting) are NOT supported when using the aforementioned ToolTipAttribute and ToolTipXXX features (they provide simple text hints only). If you require more advanced tooltips, you can implement different custom-tailored solutions for different platforms:
        WinForms:
        WinForms Controls > DevExpress.XtraEditors > WindowsFormsSettings > DefaultAllowHtmlDraw
        WinForms Controls > Common Features > HTML Text Formatting
        WinForms Controls > DevExpress.Utils > ToolTipController

        ASP.NET WebForms:
        You can integrate our DevExpress.Web > ASPxHint  component as described in the ASPxHint - How to set custom content article or demos.
        However, nothing prevents you from using standard ASP.NET or JavaScript means (e.g., JQuery - see an example here) to implement custom-tailored solutions with the desired behavior. From our controls, the ASPxPopupControl seems to be most suitable. It can be used to emulate tooltips. Please review the following demos: one, two, three. Do not hesitate to contact our ASP.NET team on this in case of any questions.

          Show previous comments (11)
          Dennis Garavsky (DevExpress) 10 years ago

            @Willem: Thank you for describing your use-case scenario. We will take it into account.
            Currently, you can use capabilities of the ToolTipController to implement this task in a ListView. Please refer to the Show tooltip with property value ticket for some example code.

              @Dennis: Thank you for referring the mentioned ticket. Somehow it didn't show up when i searched for 'tooltip'. The code is quite elaborate over there, so i'd like to vote for extending the functionality of the tooltipattribute! :)

              Dennis Garavsky (DevExpress) 10 years ago

                @Willem: Thanks for your feedback. We will take it into account. Let us know if you experience real difficulties when you have an opportunity to implement and maintain this solution in your project.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.