CRM 2011 - Choose ribbon to show by javascript - silverlight

How to pick a certain ribbon to show?
I have a Silverlight webresource inserted across the whole page and I want to show a ribbon of certain entity for it.
I suppose it's possible to do it by calling some javascript from XRM library? But I didn't find anything till now.
Thank you

You might be thinking about this backwards. You don't use JavaScript to pick ribbon to show. You set up ribbon anywhere it could show (using RibbonDiffXml) and then EnableRules and DisplayRules to control where it shows. Enable Rules allow you to specify web resources and use JavaScript to control whether the button is enabled. Unfortunately, CRM won't allow you to use JavaScript to control whether it displays (fingers crossed for future availability).
There are lots of examples out there. Here is one and two I just googled up. Be sure to reference the SDK for all the rules. Finally, if you want to short-cut learning some of the schema, you can use the Visual Ribbon Editor tool.
Note that you can either specify your ribbon customizations to a particular entity (in its RibbonDiffXml subnode) or in the global scope (exporting Ribbon Client Extensions) and use the {!EntityLogicalname} in the Id fields so CRM will generate a unique ID for the node, per entity, when it 'expands' the definition.

Related

Setting automationIDs across an existing application

If I have an existing WPF application, and I want to assign automationIDs to the entire application where they aren't set, what's a good way to do that (for controls that aren't dynamically added)? Some sort of script that goes through all the xaml files and adds automationIDs?
My goal is to write ui tests using winappdriver.
I've googled this, but haven't found anything that seems to do what I want. Perhaps I'm misunderstanding the results. This post seems to ask the same question, but I fail to see how the answer provided is an appropriate solution.
In WPF, when a control name property has a value, this corresponds with the AutomationID you will find with a UI inspector tool like Inspect.exe. Take a look at the remarks section about automationID here. So the application should already have most of its automationIDs.
The only time I did not have a automationID for a control was when the control was created in code. A script to adjust XAML won't help you here, because there won't be XAML for those controls. Even if you used a script, you won't be sure all automationIDs will be available.
When using 3rd party controls, the availability of a AutomationId depend on the 3rd party supporting it or not. If they do not support AutomationId, you could wrap that control in a custom control and expose a AutomationID that way.
Here are some resources that might be useful:
wrapped control
UI automation of a WPF Custom Control
When working with a existing application, I usually just fill in the name property for a control as I go, so the amount of change to the application stays at a minimum.

AngularJS centralized control management

I have an AngularJS application that grew up over the last months to a dozen of states with over hundred controls (input, combos, etc...).
A security-service gives me a few user-roles back (for instance a "read-only" role).
Now I'd like to know how you guys handle the management of the app's controls? I would like to to have a centralized logic/place where I could set the controls states (grey-out, disable or even hide).
I was thinking to have a own logic/schema of control IDs -> Assign each control a unique HTML ID. like "app.state.panel.control". Then based on that I could en-/di-sable a single, all or a part of the controls (for instance "state.panel.*" would address all controls of one panel).
What do you think? Any documentation discussing this topic? Any known existing Angular modules?
Thanks

Silverlight OOB User Menu Control

Well ... at the risk of sounding like I really don't know anything about programming, I have a question about controls in Silverlight 5.
I have an OOB App that I am working with, but I need to add the User Menus (File, Edit, etc.) that are normally seen at the top of all apps. There used to be a control in VS (the Menu control) that was easily configurable. What is the control used to create the User Menus in Silverlight 5? The Context Menu is not what I am asking about. That is the right mouse click menu ... so that's not the answer ...
Please, understand my problem. It's been since Silverlight 2 since I worked in Silverlight. I appreciate any information you kind folks would be willing to provide.
There is no such thing available directly from Microsoft (meaning it's neither built-in or present in the Silverlight Toolkit).
You will have to use third-party controls such as DevExpress or Telerik.
EDIT: Some more advice in response to your comment.
Another possibility is to create UIs from scratch. There are two forms of UIs that I found inspiring lately, both of which don't use any ribbons or drop-down menues at all. The first is to use "Windows 8"-like dashboards instead of traditional menues, the other is the Windows Azure Management Portal (a web application).
I don't use traditional UI frameworks for menues myself, but mostly because I don't like those approaches and I'm picky with how user interfaces should work and look like.
But obviously you have to make a serious time investment to go new ways. And it will heavily depend on your application what approach makes sense.
Here's one simple approach that could work in a number of cases, I used it for a database application (I call it the Windows-Phone-7/8 approach):
The screen is divided into the "page" area and information bars. The information bars contain no menues, just who's logged on, a back-button, a home-button, and context-sensitive buttons depending on what's in the view. So basically it behaves like a web browser and you navigate through the app by clicking on "links" (buttons that take you elsewhere).
There's only one page area, so no windows and no popups. I've gone to the extreme of making even dialog windows to be pages.
Now you need menues. You do that with "dashboards", ie. pages that present some overview stuff and buttons that lead to the other areas of your application.
Although you could have action buttons like save or delete on the page itself, I put them in the bottom bar (but they are still dependent on the page your on) - that is exactly how it works in Windows Phone 7/8.
One last advice: The real effort is usually not in the menus anyway. Beside your application logic itself, it's a lot of little things like login screen, error handling and how to present error messages (look at the windows azure management portal for how they did that really nicely) and gracefully failing on session timeout. There's also a lot of nuisance on how you manage your data (ria-services, etc.).
So as long as you don't need fancy data grid grouping, rich-text edit or excel-like pivot controls, a toolkit might not help you as much as you'd hope - because they give you only the controls, not the entire UI.

Calendar Control 12.0 Refuses Input

In Microsoft Access, I have a series of forms that require the user to specify a date range. Right now I do this with Calendar Control 12.0. However, at random times, the control refuses to accept any user input (such as changing the date).
Why would the Calendar Control refuse input? Is there any known workaround for this?
I'm running it on my development, which has the control properly registered.
One alternative to the control is a completely API generated Month Calendar derived directly from the Common Control DLL. Another alternative is to use an Access form. Which you can do anything with them you want. There are also links to several downloadable calendar forms at my website.
See the Calendar Tips page at my website In addition there could, likely will, be lots of version problems when you go to distribute the MSCal.OCX.
The Allow Edits property needs to be set to Yes to make changes to the Calendar Control. Somehow, this was set to No on the form with the control, so they would not respond to user input.
The other Data properties, such as Allow Additions, can be set to No on a dialog-style Access form.

What are my options for filtering custom .net controls from the WinForms toolbox of Visual Studio 2008?

Visual Studio 2008 does a much better job of detecting and adding controls from projects to the toolbox for use in the forms designer. If you have an assembly with a UserControl- or DataSet-derived type, then it will automatically detect and add that control to the toolbox for designing forms. This is slightly better than the old system in 2005 that made you manually add controls and would occasionally forget them, etc.
However, on the legacy, monolithic project I am working on (now upgraded to vs2008) this means many controls that I don't want and don't need (and a redesign would not be warranted against so much legacy code :( ). I imagine that if I made certain types internal or private, then they wouldn't show up. However, I need many of those to remain public, but not show up in the toolbox. Furthermore, with so many controls getting added to the toolbox, opening the winforms designer slows significantly.
Is there an attribute or other mechanism that prevents toolbox appearance (that wouldn't otherwise affect functionality) ?
Would filtering using such a mechanism improve performance while still autodetecting new types that SHOULD be in the toolbox? (I know you can disable the autodetect, but its nice to have in many cases)
Have others encountered this irritation on large solutions (with many csproj/vbproj files)?
Edit: Thanks everyone! I knew it had to be simple (and was likely an attribute) but that fills the gap. Nice to know that I was in good company in not knowing about ToolBoxItem(false).
The following attribute should hide it from the toolbox:
[ToolboxItem(false)]
If you apply it to all the types you don't want to show, it will still show any new ones you create without this attribute. Note, you may have to manually remove the items to start with.
This blog post shows some other attributes you may want to use.
Go through the toolbox and for each custom control that you see that you want to hide, add the following attribute above the class:
[ToolboxItem(false)]
Of course, this is a compiled attribute and will affect everyone using the code, so I only recommend doing this for controls that don't make drag-drop sense. Otherwise, you will probably make someone that loves that control very very angry. :)

Resources