This is a migrated thread and some comments may be shown as answers.

Commands in Toolbar & IsLocked

21 Answers 351 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Nils
Top achievements
Rank 1
Nils asked on 22 Sep 2009, 08:49 AM
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

21 Answers, 1 is accepted

Sort by
0
Accepted
Ivan
Telerik team
answered on 24 Sep 2009, 02:11 PM
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.
0
Alan Adorjan
Top achievements
Rank 1
answered on 26 Jan 2010, 12:11 AM
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!
0
Kiril Stanoev
Telerik team
answered on 28 Jan 2010, 09:39 AM
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.
0
Rick Knicely
Top achievements
Rank 1
answered on 22 Jul 2010, 08:48 PM
Has dragging of the toolbars been implemented yet?
0
Valentin.Stoychev
Telerik team
answered on 23 Jul 2010, 10:23 AM
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
0
Rodney Foley
Top achievements
Rank 1
answered on 09 Jun 2012, 12:51 AM
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. 
0
Lancelot
Top achievements
Rank 1
answered on 11 Jun 2012, 10:35 PM
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
0
Rodney Foley
Top achievements
Rank 1
answered on 11 Jun 2012, 10:41 PM
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.
0
Tina Stancheva
Telerik team
answered on 13 Jun 2012, 11:45 AM
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 >>

0
Rodney Foley
Top achievements
Rank 1
answered on 13 Jun 2012, 02:38 PM
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. 
0
Tina Stancheva
Telerik team
answered on 13 Jun 2012, 03:48 PM
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 >>

0
Rodney Foley
Top achievements
Rank 1
answered on 13 Jun 2012, 04:04 PM
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. :)
0
Petar Mladenov
Telerik team
answered on 18 Jun 2012, 11:33 AM
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 >>

0
Rodney Foley
Top achievements
Rank 1
answered on 18 Jun 2012, 03:02 PM
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. :)
0
Petar Mladenov
Telerik team
answered on 21 Jun 2012, 08:08 AM
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 >>

0
Greg
Top achievements
Rank 1
answered on 28 Jul 2016, 02:42 PM
Sadly in mid 2016 still can't drag toolbars around : (
0
Petar Mladenov
Telerik team
answered on 29 Jul 2016, 06:41 AM
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.
0
Greg
Top achievements
Rank 1
answered on 29 Jul 2016, 10:24 AM
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?
0
Petar Mladenov
Telerik team
answered on 01 Aug 2016, 06:34 AM
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.
0
Greg
Top achievements
Rank 1
answered on 01 Aug 2016, 07:32 AM
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?
0
Petar Mladenov
Telerik team
answered on 02 Aug 2016, 07:28 AM
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.
Tags
ToolBar
Asked by
Nils
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Alan Adorjan
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Rick Knicely
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Rodney Foley
Top achievements
Rank 1
Lancelot
Top achievements
Rank 1
Tina Stancheva
Telerik team
Petar Mladenov
Telerik team
Greg
Top achievements
Rank 1
Share this question
or