Is there a way to add a customized lookupedit to DevExpress.XtraBars.Ribbon.RibbonControl? In my RibbonPageGroup, I can right click to add controls including LookUpEdit. But if I want to add my customized control to RibbonPageGroup, is it allowed and how to do that? I search online but didn't find much useful information about it. Thanks! I am working on WinForms.
This can be only done if this control is derived from the DevExpress.XtraEditors.BaseEdit class. Also, you should register the corresponding RepositoryItem as it is described in the How to register a custom editor for use in the XtraGrid article.
Related
I am trying to add a button to the ribbon using CommandBars, but I can't find any example or a way to do that.
I cannot use the CustomUI XML because I need to change the visibility of the button, and it is not supported by the CustomUI XML.
I have found a CommandBar called "Ribbon" with a CommandBarControl that is called "Ribbon" as well, but I don't see how I use it to place a button on "TabHome".
Does anyone know what am I missing here? or can point me out to an example?
Thanks!
As far as I know, you can't use CommandBars to control ribbon. And it makes no sense to do so, as CommandBars technology is depreciated for ribbon ui, and basically supported for compatibility only.
Did not quite get why you don't want to use ribbon xml to customize ribbon? It's the official way. To control button visibility, you should simply set a "getVisible" attribute of the button to your event handler (callback) and and in that callback return true/false to show/hide the button...
What you can't show/hide dynamically are built-in office buttons, but you should be able to show/hide your own buttons without any issues.
Looks quite similar to this one:
Is there a way to use VBA and XML to add a button to the Office 2010 Ribbon depending on a string in the file name?
I have been trying to customize a webbrowser control in wp7. All I need to do is to add a border property(I think it is already available in webbrowser but I have to make it mandatory when I make it as a control) and want to add a few extra event handlers and make it as a control so that it can be used later in different projects.
I tried reading through materials in msdn for writing control template and it all revolves around writing a few xaml code and attaching it with codebehind to make it work. What I don't understand is how do I learn xaml? or in other words where is the reference for all the tags that msdn talks about in xaml? Itseems to be huge and I am not sure how to go about it. The tutorial in msdn straight away divulges into xaml code and I am totally confused..
So now all I am trying to do is this,
create a control in Expression Blend (Windows Phone Control Library) that would create a class (MyCustomControl) that inherits
from CustomControl base class.
Now in xaml I am adding a webbrowser control and adding four event handlers (mouseup,down etc.,).
I build this control in blend and add the corresponding dll in VS2010.
And now once I try to add this control to my wp7 phone application it says "Cannot create an instance of MyCustomControl"..
These were further links that I referenced in creating one,
Windowsphone - Creating a custom control
Windowsphone - Control Template.
UserControl vs Custom Control
Creating a new control by creating ControlTemplate
Any further help would be great.
There is no definitive list of 'elements' you can add to your XAML. The reason for this is that the XAML parser can create any class which is a UIElement based on the XML you provide. So the elements available to you depend on the assemblies present in your project. Read teh MSDN XAML Overview for details
For a list of controls that are present by default, take a look at the System.Windows.Controls namespace (I think this link is not for your version of Silverlight, it might be best to use the Object Browser to look at the assemblies in your project).
For your problem, where you want to add a border to a WebBrowser control. I would recommend creating a UserControl as per this tutorial.
I was wondering how could I save a user control just like we can save a c# class in a dll file and import that file whenever we need to use that class. How could we import that control and use it. It will be nice if we could make custom controls and save them for reuse instead of having to copy the xaml and code behind every time we had to use it.
You have exactly that flexibility with WPF and a lot of choices. Here is an excellent introduction to your options:
Control Authoring Overview
These choices include:
Deriving from UserControl
Deriving from Control
Deriving from FrameworkElement
The tradeoffs are described in detail in the article.
So I have a few tabs in the form, and i want it to work like that:
When you click on the tab's name, it becomes editable, and when i stop editing it remains with the new name.
How would i do that with C# and winforms?
You can dynamically create a text box and place it over the tab area to make the user think they are editing the tab directly. When the text box loses focus you can then put the typed in value into the tabs property.
I agree with Eric, regarding how you could do this with the standard TabControl. You could also provide a dialog to do the name change (a slight variation on Eric's suggestion).
However, I would also recommend that you consider rolling your own tabbed control. They're not difficult to create and by rolling your own, you will be able to put in the exact functionality you need in a robust way rather than trying to piece it together from existing components that may not play nicely together.
There's no standard Windows control that does this, so you'll either need to look for a third-party control with this functionality (iffy) or write your own control which draws the appropriate edit box on the tab, etc.
My question is related to this question:
Baseline snaplines in custom Winforms controls
However, in my case, I have created a new control that derives from TextBox rather than containing a TextBox. I would like to have a custom ControlDesigner, but I would like to modify the behavior of the TextBox's designer rather than having to write a complete designer myself. In particular, I'd like to be able to return the TextBox's SnapLines while providing some custom verbs. Is there a good way to do this?
EDIT: To clarify, this is for Windows Forms in .NET 2.0.
In the end, the solution I settled on was to create a dummy control in the designer, sync the relevant properties with the real control, get the designer for the dummy control, and then return the snaplines from the dummy control's designer. It's a terrible hack, but it seems to be the only way without using reflection to "extend" a designer.
What about having your ControlDesigner derive from the one that TextBox is using? Did you try that and find a problem?