Ticket T690584
Visible to All Users

The new Accordion NavBar does not show images

created 6 years ago

[DevExpress Support Team: CLONED FROM T689702: Images in navigation pane]

Strangely the new accordion navbar does not show images, even when you set ShowImages=true in the application model (which is its default value, by the way).

I have written a quick-fix using a WindowController that I'd like to share with you below. But I suppose the missing images can be considered a bug.

C#
public class AccordionImagesWindowController : WindowController { public AccordionImagesWindowController() { InitializeComponent(); TargetWindowType = WindowType.Main; } protected override void OnActivated() { base.OnActivated(); ShowNavigationItemController navigationController = Frame.GetController<ShowNavigationItemController>(); if (navigationController != null) { Frame.GetController<ShowNavigationItemController>().ShowNavigationItemAction.CustomizeControl += ShowNavigationItemAction_CustomizeControl; } } protected override void OnDeactivated() { ShowNavigationItemController navigationController = Frame.GetController<ShowNavigationItemController>(); if (navigationController != null) { Frame.GetController<ShowNavigationItemController>().ShowNavigationItemAction.CustomizeControl -= ShowNavigationItemAction_CustomizeControl; } base.OnDeactivated(); } private void ShowNavigationItemAction_CustomizeControl(object sender, CustomizeControlEventArgs e) { AccordionControl accordion = e.Control as AccordionControl; if (accordion == null) return; AddImages(accordion.Elements); } private void AddImages(AccordionControlElementCollection elements) { foreach (var element in elements) { element.ImageOptions.ImageLayoutMode = ImageLayoutMode.Stretch; var cai = (element.Tag as ChoiceActionItem); if (cai != null && cai.ImageName != "BO_Folder") { element.Image = ImageLoader.Instance.GetImageInfo(cai.ImageName).Image; } AddImages(element.Elements); } } }
Show previous comments (1)

    Sure, please find the sample attached, generated with V 18.2.3.0

    Reproduction steps:

    1. Create new XAF solution
    2. Add business class
    3. Change class image to real image (I picked from SVG lib)
    4. Set Navigation style to Accordion in App model
    5. Run. Accordion has no images.

      Plase also note: The ShowImages property on the Navigation node is already set to true by default. I tried setting it to true explicitely, but that didn't help.

        Sorry, one more note: I just upgraded another (existing) 18.1 project to 18.2, and there the accordion shows images! So I'm beginning to suspect that the problem could lie within your VS templates of 18.2.

        By the way, the tab images expose the same problem: A newly created 18.2 solution shows no tab images, while the upgraded solution displays them perfectly.

        Answers approved by DevExpress Support

        created 6 years ago (modified 6 years ago)

        Marco,

        Thank you for the detailed information. It looks like you have two different scenarios here.

        1. In the first case, you have a new project generated with XAF 18.2.3.0. While the ShowImages value is true in the AccordionImages.Module and AccordionImages.Module.Win projects, it is false in the AccordionImages.Win project. All new applications created in XAF 18.2.3.0 have the ShowImages property set to false in the YourSolutionName.Win project. To display images, do the following:
          - Invoke the Model Editor from the AccordionImages.Win project.
          - Click the NavigationItems node.
          - Set the ShowImages value to true.
          - Save.

        Note that if end users accessed the end-user Application Model's layer, they may need to manually set ShowImages to true in their application.
        You can learn more about the Application Model's layered structure in the following article: Application Model's Layered Structure.

        1. In the second scenario, you have an older project upgraded to v18.2. All projects created in older XAF versions have ShowImages set to true on all Application Model layers. The ShowImages values did not change when you upgraded the project. That is why in the second case, you can see the images.
          Images in tabs work in a similar fashion and are controlled by the ShowTabImage property.

        Please let me know if my further assistance is required.

          Show previous comments (3)
          DevExpress Support Team 6 years ago

            Hello Dom,
            Thank you for your question. If you are using the Solution Wizard to create a new WinFroms application, the Solution Wizard sets the ShowImages property to false in the YourApplication.Win project. This means, the Accordion images are turned off in the Application Model's application layer and can be turned on at only that level. I suspect you may have changed model options either in the YourApplication.Module.Win or YourApplication.Module project, and that is why the images are invisible. Please invoke the Model Editor from your WinForms application project and check that ShowImages is set to true there.
            Please let me know if this helps.

              Hi Vera

              Thank you, your diagnosis of my error was spot on, images are now appearing on the accordion.

              Is there an article anywhere that lists all of the defaults set by the solution wizard, and where they have been set?

              Dom

              DevExpress Support Team 6 years ago

                Excellent - I am happy to hear you were able to make this work. You can find a complete list of default settings in the following KB article: Default XAF configuration options and feature toggles.

                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.