Posts Tagged ‘VS2010’
December 29th, 2011 by Tobias Zimmergren
Sometimes when you’re in a development project you can feel the pain of debugging. If there’s a lot of code floating around it may be hard to sort out the method calls and how the depend on each other if it’s a very complex solution. To ease the task of debugging there’s a great VS 2010 plugin called Debugger Canvas, which will help you to sort out a lot of the hassle while debugging.
In this article we’ll just take a quick look at what Debugger Canvas is and how it can assist us in our daily debugging adventures.
Getting Started with Debugger Canvas
Firstly, you obviously need to download the extension for Visual Studio 2010, which can be done HERE.
Debugger Canvas in Action
When you’ve installed the extension, there’s a few new opportunities presented when debugging. Your new “F5” experience will be based on the new Debugger Canvas UI instead of the traditional debugging experience which means you’ll be able to more easily follow the calls within your code, like this:
When you step into the code deeper, you’ll see how the calls were made quite easily:
You should definitely take a look at Debugger Canvas if you haven’t already as it’ll be most helpful for you in your development adventures.
Get a better overview here and watch the introductory video!
December 28th, 2011 by Tobias Zimmergren
In most of my recent projects I’ve been required to hook up some custom functionality and add custom forms, pages and Web Parts. Some of the forms and pages I designed needed to be launched from the Ribbon menu, which of course is contextual. This basically means that when you visit a specific list which inherits from a specific content type, we can choose to display our custom Ribbon controls. One of the most common requirements I bumped into was having some kind of conditional check whether to enable or disable the button based on a set of conditions.
In your Ribbon XML for the CommandUIHandler there’s a property called “EnabledScript” which is a tag that enables you to enter a validation script to determine whether or not the ribbon button should be enabled. In my case I need to disable the custom Ribbon-controls if one item is selected, but otherwise always disable it.
It’s really only the last line that is of interest here since that’s where the script magic happens to determine if the control should be enabled or not.
MSDN have some nice samples in one of their articles over here.
If you select one (and only one) item in the list, your custom command will be enabled:
If you didn’t select or selected more than one item, the command will be disabled as such:
I know many people have been struggling with the Ribbon and making it behave. In this article I simply wanted to highlight one of the very common tasks I’ve seen developers looking for and trying to achieve in some of the last few projects I’ve been involved.