Commands in Toolbar & IsLocked

22 posts, 1 answers
  1. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 22 Sep 2009 Link to this post

    Hi. I am having some difficulties using the RadToolBar.
    The following code (utilizing the standard toolbar) works just fine:
    <ToolBarTray DockPanel.Dock="Top" 
                 IsLocked="False"
         <ToolBar BandIndex="0" 
                  ToolBarTray.IsLocked="False"
              <Button Click="Button_Click">foo</Button> 
         </ToolBar> 
         <ToolBar BandIndex="0" 
                  ToolBarTray.IsLocked="False"
              <Button Command="ApplicationCommands.Cut" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
              <Button Command="ApplicationCommands.Copy" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
              <Button Command="ApplicationCommands.Paste" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
         </ToolBar> 
    </ToolBarTray> 
    i.e. Commands are active when inside a TextBox otherweise not and the two Toolbars are repositionable inside the ToolBarTray.

    However, when I switch to RadToolBar....
    <telerik:RadToolBarTray DockPanel.Dock="Top" 
                            IsLocked="False"
         <telerik:RadToolBar BandIndex="0" 
                             telerik:RadToolBarTray.IsLocked="False"
              <Button Click="Button_Click">foo</Button> 
         </telerik:RadToolBar> 
         <telerik:RadToolBar BandIndex="0" 
                             telerik:RadToolBarTray.IsLocked="False"
              <Button Command="ApplicationCommands.Cut" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
              <Button Command="ApplicationCommands.Copy" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
              <Button Command="ApplicationCommands.Paste" 
                      Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" 
                      HorizontalAlignment="Center" 
                      VerticalAlignment="Center" /> 
         </telerik:RadToolBar> 
    </telerik:RadToolBarTray> 
    The Commands are Disabled and do not enable and the ToolBars are not repositionable inside the ToolBarTray.

    Have I misread the Documentation on RadToolBar ?

    Yours, Nils
  2. Answer
    Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 24 Sep 2009 Link to this post

    Hello Nils,

    Thank you for reporting the command-issue. We will do our best to fix the case for the next release.

    About movement / dragging of the toolbars inside a tray. We confirm that toolbar is not draggable - we are working on this functionality for our Q3 release.

    PS: According this report we updated your Telerik points.

    Best wishes,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alan Adorjan
    Alan Adorjan avatar
    3 posts
    Member since:
    Jan 2010

    Posted 25 Jan 2010 Link to this post

    Seems like in the Q3 release the toolbars are still not draggable.  When do you expect this functionality to be available?  Also, do you plan on supporting a right-click Customize function like in Visual Studio?
    Thanks!
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 28 Jan 2010 Link to this post

    Hi Alan,

    Currently the priority of the "draggable toolbars" feature is low compared to other features and it will not be included in our Q1 2010 release. Most probably we will start implementing it during Q2 2010.
    Your other feature request, "supporting a right-click Customize function", will definitely be considered for future versions of RadRibbonBar. Let me know if you have additional questions or comments on the matter.

    Greetings,
    Kiril Stanoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Rick Knicely
    Rick Knicely avatar
    43 posts
    Member since:
    Apr 2010

    Posted 22 Jul 2010 Link to this post

    Has dragging of the toolbars been implemented yet?
  7. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 23 Jul 2010 Link to this post

    Hi Rick Knicely,

    This feature is still not implemented.

    Sincerely yours,
    Valentin.Stoychev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 08 Jun 2012 Link to this post

    How about now? Its 2012 and they still don't seem to be movable.  Seems like a really long time not to implement feature parity with standard WPF controls.

    Oh and if they are not going to be movable can you remove the Grips which is the standard hint to the user that they are movable. Normally setting ToolTray.IsLocked to false does the job, it doesn't work on Rad versions. 
  9. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 11 Jun 2012 Link to this post

    Hi Rodney,

    Yes, the toolbar can be set to unlocked and you can move items in around within the tray. Here is the xaml method to do so.

    <telerik:RadToolBarTray IsLocked="False">
        <telerik:RadToolBar telerik:RadToolBarTray.IsLocked="False" />
    </telerik:RadToolBarTray>

    There are other ways to enable this feature, this documentation goes into depth on the feature.

    I hope this clears things up for you, Good Luck!

    Lancelot
  10. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 11 Jun 2012 Link to this post

    Hi Lancelot,

    Sorry to say that doesn't work as of the latest internal build for WPF in a real world scenario.  

    First having a single ToolBar in a tray and "moving" it is not useful so if your snippet works its a pointless unrealistic example.

    Try it when you have a few different Bars in a Tray with some on the same band but with different indices, and some on a different band with different indices and  IsLocked is false on both the tray and the bars you can't move them.  The purpose would be to allow the different bars to move within a band and across bands.  Good example of expected user experience would be Visual Studio 2010.

    I am also very familiar with the WPF version of those docs which look just like the Silverlight ones for the most part.  Also they do not go into much of any depth on the feature in question actually. That page is very light on this feature and showing how to use it and providing a working example.  It dedicates two sentences and one note, and the sample code you copied and pasted from that page to your post. That is not going into depth on the feature.
  11. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 13 Jun 2012 Link to this post

    Hello Rodney,

    Thank you for getting back to us. You are right that the current logic for moving the bars in a ToolBarTray won't allow you to implement your scenario.

    This is why based on your feedback we decided to raise the priority of the RadToolBar-related tasks. During this release cycle, we will do our best to implement the required drag/drop functionality out-of-the-box. You can track the progress of the task in our PITS.

    We will also update the documentation accordingly so that it can provide a detailed information on every feature of the RadToolBar.

    In the meantime you can try to implement a custom scenario for dragging the ToolBars by taking advantage of the DragDropManager.

    Regards,
    Tina Stancheva
    the Telerik team

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

  12. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 13 Jun 2012 Link to this post

    Thanks, I added a comment to it since the description is very light and it is not a clear issue/feature as it is written. Drag and Drop could mean I want to have the user customize the toolbar by dragging buttons and other controls on and off of it.  But that is not what is being requested, it is really MOVING toolbars within a tooltray. 
  13. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 13 Jun 2012 Link to this post

    Hi Rodney,

    Thank you for getting back to us and for your elaborate comment on the issue. I used it to update the description of the item, I hope that's ok.

    Also, in my previous post, I left out the RadToolBar.GripVisibility property that can be set to Collapsed to hide the grip of the toolbars so that the users won't be mislead that you can drag around the bars.

    Greetings,
    Tina Stancheva
    the Telerik team

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

  14. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 13 Jun 2012 Link to this post

    Its all good, and BTW I took the RAD Tray and Bars out of my app because of another issue that was not tolerable I just haven't had time to report it as it may be by design which would be sad. But essentially when you put a text box in a toolbar it doesn't size as expected and it seems to ignore all your settings that usually work in stack panels, dock panels, etc. So because a ToolBar doesn't grow and shrink as needed when you size a window to just clip the bar a little bit the text box disappears and goes into the overflow.  It would really be nice if we could flag a control in a toolbar to be stretchable and decide as what size they go into the overflow bar.  

    And when say it would be nice to do this, it should be part of the base control and I as a developer shouldn't have to monkey with styles. I am have no problem extending features with attached properties and behaviors but once it requires style changes to work around and issue or to make changes to stuff like that I just back away and find another control or option. Style's are really for those experienced with Blend, and I have not had enough time a sole developer with none of our UX resources (people) to spend much time with blend. So having to do styles hacks in Xaml is painful. Anyways, this is off topic sorry about that, so I end it here. :)
  15. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 18 Jun 2012 Link to this post

    Hello Rodney,

     I think this behavior is expected by design. You can see the VisualStudio's editable ComboBoxes in the toolbars. When you shrink the VS, the Combo disappears, it does not change its width. However, we could log a feature request if this is suitable for you. 

    Greetings,
    Petar Mladenov
    the Telerik team

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

  16. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 18 Jun 2012 Link to this post

    I agree it is by design but that design was done back before people where placing textboxes and editable comboboxes in them and they haven't adjusted how toolbars work since. With this design you have to lock the editable combo box or textfield to a small fixed size to prevent them dropping off if even a small window resize change and this would be good when you are expecting small amount of text.  However it would be nice to have the ability to make the toolbar obey the sizing set for a control and also allow us to tell a toolbar to FILL or Stretch so it will take up the remaining space.  This can make for a better UX in situations where you don't want your control to go into the overflow until it has met its minsize.

    So, in short, I guess I am asking for a feature to the tray and bars. :)
  17. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Jun 2012 Link to this post

    Hi Rodney,

     We logged a feature in our PITS and you are now able to vote for it.

    All the best,
    Petar Mladenov
    the Telerik team

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

  18. Greg
    Greg avatar
    34 posts
    Member since:
    Sep 2012

    Posted 28 Jul Link to this post

    Sadly in mid 2016 still can't drag toolbars around : (
  19. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Jul Link to this post

    Hello Greg,

    Several years ago we added an SDK demo in github showing how drag-drop of toolbars can be achieved.
    Please check it out here. Also, please have in mind that to search for any sdk demo for particular control, you can refer to its developer focused samples page where grid with search / filter functionality can help.

    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  20. Greg
    Greg avatar
    34 posts
    Member since:
    Sep 2012

    Posted 29 Jul in reply to Petar Mladenov Link to this post

    Hello, Mr. Mladenov,

    that demo looks really good and it certainly improves the standard functionality, but I have a few questions:
    1. how can I prevent the dragged toolbars from becoming standalone windows?
    2. how can I make it so that when a toolbar is being pushed into it size changes? (like the regular .net toolbar controls work)
    3. How to freely drag toolbars anywhere on the available band space?
  21. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 01 Aug Link to this post

    Hello Greg,

    1) To prevent new WIndows when you complete the drag operation you can comment the following lines:
    private static void ToolBarDragDropCompleted(object sender, DragDropCompletedEventArgs e)
           {
               RadToolBar toolBar = e.Source as RadToolBar;
               DragDropInfo info = GetDragDropInfo(e.Data);
               if (toolBar == null || info == null)
               {
                   return;
               }
     
               DragDropManager.RemoveDragDropCompletedHandler(info.ToolBar, ToolBarDragDropCompleted);
               DragDropManager.RemoveGiveFeedbackHandler(info.ToolBar, ToolBarGiveFeedback);
     
               ClearActiveToolBarStyle(info.ToolBar);
               ClearHitTesting(info.Tray.Items);
               CloseHost(info);
               if (info.DragVisual.Child != null)
               {
                   info.DragVisual.Child = null;
     
                   //Window dragVisualWindow = Window.GetWindow(info.DragVisual);
     
                   //InitializeHost(info.ToolBar, dragVisualWindow.Left, dragVisualWindow.Top);
               }
     
               HideNewBandIndicator(info.Tray);
     
               e.Handled = true;
           }

    2) To implement resize you need to extend the current DragDrop mechanism in the application with methods to update the Width / Height of the ToolBars. Also probably you will need new indicator or mechanism to make difference between drag outside tray and drag inside tray / resize. To be more familiar with DragDropManager we encourage you to explore its documentation.

    3) Freely dragging is hard to implement because the panels in which the RadToolBars reside are much like stackpanels. You either have to play with the Margins property of the toolbars (which is honestly a hack) or add the ToolBars in Canvas  (other panel) and do not use a ToolBarTray. These are the main reasons we haven't included such functionality in the demo - it would require a lot of code and wouldn't use our ToolBarTray panel. We hope you will be able to implement such solution on your own.

    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  22. Greg
    Greg avatar
    34 posts
    Member since:
    Sep 2012

    Posted 01 Aug in reply to Petar Mladenov Link to this post

    Thank you for the information, it most certainly helped pointing into the right direction.
    In regard to the floating toolbars, I have tried the solution you've offered- and it does prevent the creation of a floating window, but the toolbar doesn't return to the tray so I've added "info.Tray.Items.Add(toolBar); " and it's all good. Thank you.

    Just one more question: is there a way to prevent a toolbar from being able to be dragged from its original tray to a different tray?
  23. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 02 Aug Link to this post

    Hello Greg,

    Code which moves the ToolBar away from its tray is in TrayDraggedOver :
    private static void TrayDragLeft(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
            {
                RadToolBarTray tray = sender as RadToolBarTray;
                DragDropInfo info = GetDragDropInfo(e.Data);
                if (tray == null || info == null)
                {
                    return;
                }
     
                ClearHitTesting(tray.Items);
                //MoveToolBarToDragVisual(info, tray);
                HideNewBandIndicator(tray);
            }
    This way you won't need to re-add the bar again in its tray.

    And the code which moves the toolbar in new tray is in TrayDragEntered method:
    private static void TrayDragEntered(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
    {
        RadToolBarTray tray = sender as RadToolBarTray;
        DragDropInfo info = GetDragDropInfo(e.Data);
        if (tray == null || info == null)
        {
            return;
        }
     
        lastInitializedInfo = null;
     
        //if (!tray.Items.Contains(info.ToolBar))
        //{
        //    var positionInfo = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, tray, e.GetPosition(tray));
        //    MoveToolBarToTray(info, tray);
        //    bool allowNewBandCreation = GetNewBandMode(tray) == NewBandMode.Live;
        //    BandsUtilities.UpdateToolBarPosition(tray, info.ToolBar, positionInfo, allowNewBandCreation);
        //    UpdateNewBandIndicator(info, positionInfo, tray);
        //    SetHitTesting(tray.Items);
        //}
     
        e.Handled = true;
    }

    Generally we encourage you to place breakpoints in all drag drop methods and debug a simple drag drop flow. This will give you better overview of how drag drop is implemented in the solution and where you need to plug in your logic / remove the existing one.


    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready