Popup size on diagram

8 posts, 1 answers
  1. Wenrong
    Wenrong avatar
    36 posts
    Member since:
    May 2012

    Posted 27 Jun 2012 Link to this post

    Currently the zoom behaviour of the popup on a diagram is determined by the zoom level of the diagram when the popup is opened. Any subsequent zooming action would not change the appearance of the popup. This can be observed in the MindMap sample.

    Is it possible to change this behaviour so that the popup is always displayed without zoom render transform? just like when using the ItemInformationAdorner.AdditionalContent?
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 27 Jun 2012 Link to this post

    Hello Wenrong,

     The Popup within the MindMap example is placed inside the Shape's ControlTemplate and so it is part of the zoom-able visual tree. This is just for the sample, but I would recommend you to do it using the Selection adorner or to modify the Settings Pane control to suits your need. (Actually the Settings Pane is usually added to the ItemInformationAdorner.AdditionalContent. For the next release of the samples we'll also improve this behaviour.
    Please let us know if you have further questions. 

    Greetings,
    Miro Miroslavov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Wenrong
    Wenrong avatar
    36 posts
    Member since:
    May 2012

    Posted 27 Jun 2012 Link to this post

    Hmm... do you have any example of using a selection adorner? My popup control is only specific to each item (rather than to a group of items), that's why I chose to follow the MindMap example in the first place as the ItemInformationAdorner.AdditionalContent seem to be applied to the current selection, be it a single shape or a group of shapes...
  5. Wenrong
    Wenrong avatar
    36 posts
    Member since:
    May 2012

    Posted 28 Jun 2012 Link to this post

    Thinking about it, it would work if I can make the ItemInformationAdorner only appear when there is only one item selected.

    Is that possible?
  6. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 29 Jun 2012 Link to this post

    Hello Wenrong,

     The ItemInformationAdorner is placed on the same size as the Selection Adorner, meaning that currently the only way to make it appears on one item is to use Single selection instead of multiple. 
    So if this is not an option, we have only two options right now - to reverse scale/zoom it (if you go the Mindmap way), which could be somehow hard to do. Or the other option is to change the diagram template and there is a way to add there a new adorner that you can later place only on single shapes. Actually you can do that outside the Diagram - you can handle the Selection event and place a popup (or floating canvas) next to the selected shape. You can easily get the actual position of the Shape and just place your adorning thing there.
    In the meanwhile, I'll add a work item so that we must provide an API for easier way of doing this.
    Please let us know if any of these solutions work for you, or you need further assistance. 

    Greetings,
    Miro Miroslavov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Wenrong
    Wenrong avatar
    36 posts
    Member since:
    May 2012

    Posted 30 Jun 2012 Link to this post

    Yup, the last option worked for me. Thanks.
  8. Aakansha
    Aakansha avatar
    20 posts
    Member since:
    Sep 2014

    Posted 27 Nov 2014 in reply to Miro Miroslavov Link to this post

    Hi Miro...can you give me sample project to understand how can I control Popup size on diagram without getting it effected by the diagram size of mind map. I am not able to understand from the above answers.
  9. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 01 Dec 2014 Link to this post

    Hi Aakansha,
    One way to achieve this is to change the DropDown button in the MindMap shape's styles with a toggle button:
    <telerik:RadGeometryToggleButton x:Name="settingsPaneButton"
            IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSettingsOpen, Mode=TwoWay}"
            Style="{StaticResource SettingsPaneToggle}" />
    Then handle this toggle button's Checked and Unchecked events and open/close a separate popup (which is not part of the RadDiagram) containing the SettingsPane:
     
    this.AddHandler(RadGeometryToggleButton.CheckedEvent, new RoutedEventHandler(OnChecked));
    this.AddHandler(RadGeometryToggleButton.UncheckedEvent, new RoutedEventHandler(OnUnchecked));
     
    private void OnUnchecked(object sender, RoutedEventArgs e)
    {
        var button = e.OriginalSource as RadGeometryToggleButton;
        if (button != null && button.Name == "settingsPaneButton")
        {
           ...
        }
    }
     
    private void OnChecked(object sender, RoutedEventArgs e)
    {
        var button = e.OriginalSource as RadGeometryToggleButton;
        if (button != null && button.Name == "settingsPaneButton")
        {
            ...
        }
    }
    You'll also have to handle a couple of diagram events to close the Popup - PreviewZoom, PreviewDrag and etc.
    I've attached a sample project demonstrating this approach for the MindMap's Root and FirstLevel shapes so could you please examine it and tell us if this is what you're looking for. 


    Regards,
    Zarko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready