Creating a SQL Server view designer like control - c#

I am in need of a view like designer for Winforms, so really I just need to make a control, but I'm not sure what path to go down or whether or not it has already been done.
I need something like this:
How do you think I should go about it?
Do you think that this is done in some kind of canvas? Or is there actually something that does this? I only need one with two lists that I can use multiple times. Suggestions?
EDIT
Its not a query designer that I want, but simply the mapping of one key to another.

This one by Bernardo Castilho, the CTO of componentone:
http://www.codeproject.com/Articles/43171/A-Visual-SQL-Query-Designer

Related

Create a scrollable list of items and their properties in Winforms

I have a class and a bunch of objects of that class; I would like to create a scrollable list displaying a list of these objects' properties. How could I go about this in windows forms?
I need to format it in a way that the user can add and take away from the list any time they would like.
To clarify, have a box that has 1 objects properties, the second thing in the list would have the other objects properties, etc.
I would like to do it in a visually pleasing way as well, not just text. Maybe have a box with all the things displayed in it.
I am using c#, if that helps.
PS: I am not asking you to do it for me, but for a way to go about doing it myself.
Thanks in advance to anybody who replies. If you need any more info I will gladly give it to you.

Change the auto-complete behaviour of a textbox

I have two doubts about the autocomplete feature of textboxes in C#.
First, I want to display the full list, not only the ones that start with the given text, and secondly I want to prevent the auto-complete of specific options (some are category titles).
I've been checking the textbox properties and there's nothing related to it, so probably the main question could be, Is there a way to modify / override the textbox events in order to handle the auto-complete actions? (I don't know if it applies to show the full list too)
I assume you're asking about a winforms textbox, as I dont think the WPF textbox supports autocomplete at all.
The base TextBox class will not support doing what you want, so you could in theory attempt to override all of the functionality in the TextBox class to do what you want, but the better idea would be to create a new custom control that inherits from TextBoxBase and implement the autocomplete behavior the way you want it.
I'm not sure about displaying the full list (perhaps a combobox or similar is more suited to this?) but you can definitely do something like this to swap which list of possible items can be displayed.
Another option, though one I like less, is to remove items you don't want to display at a given time from the collection dynamically, like this: textBox.AutoCompleteCustomSource.Remove("ACategoryTitle")
I could foresee that approach having many problems with trying to rebuild the list constantly. I would probably create a subclass of AutoCompleteStringCollection that wraps some LINQ code to nicely select the union of some lists and not others to display in the textbox.
I decided to build my own autocomplete tool with the help of a simple listbox and events, then I could achieve what I was expecting..
The CodingGorilla's answer probably leads to a better solution if you want something more decent, in my case for speed reasons I decided to do it that way but I'll mark his answer as the accepted in order to help other people who have the same doubt and they could consider that point..

When is the LayoutEngine invoked in winforms?

Yesterday I found out that when you need to create controls at runtime, you can use the LauyoutEngine to place the controls at the right location. I always used the TableLayoutPanel for this, but I must say, the LayoutEngine works better and I have more control now.
But I was wondering, how does this work under the hood? When is the LayoutEngine property invoked? And when is it a best practice to use the layout engine?
The LayoutEngine property is accessed/created (and cached!) in the (base) constructor of the Control. So if you want to use it, you need to subclass Control or Panel and override LayoutEngine.
Try to avoid it. Your UI component:
is fairly simple ? Don't use it, you'll shoot yourself in the foot.
is getting more complex ? Try to solve it by compositing multiple panels, they get you quite far.
might be re-used somewhere else ? Try not to use it, you won't get all the different layout use-cases right (Padding/Margin/DockStyle/DockPadding/Anchors/AutoSize/AutoScroll/...) and it'll be a mess.
Maybe, if your UI component
is a composed out of more inner controls
you're trying to do something fancy and need more control
none of the inner controls should be accissible/extended
you're willing to spend more time than figuring out why your TableLayoutPanel/FlowLayoutPanel/... doesn't layout the way you want it to
... then by all means, give it a shot! You could get some quick results, but you'll find yourself rewriting the layout method more than you'd like.

Binding C# Objects to ListView / control

I have a class that returns a list of "Category" Objects. I'd like to display them along the left-hand side of the page in a listview (if that's the best way to do it, even).
The category objects have normal attributes. Title, User, NumberOfProjects. I'd like to display both the title and the number of projects in this list.
Not worried about editability right now as we might make that separate (i.e. not in-line in a list view edit mode).
What do you think is the best way to do this?
Thanks in advance for any help you can give! :)
First if the array of the objects is too big I'd recommend to use virtual mode of ListView.
Second, nice way to "convert" youur object to string is to override ToString method where you can represent info of your object.
One alternative is to bind your collection to a DataGridView and display that, which would save you having to load each item manually but looks tacky and like it was made in Access.
Personally, I'd use a list view as you've suggested. I find that although you have to load its items manually, its simple and looks by far the most professional.
I was just looking for the best way to use a ListView control, I suppose.
I was able to figure it out -- I wasn't using correctly and hadn't included a "contentPlaceholder" element.
After doing this, I was able to use <%#Eval("FieldName")%> to insert the object's properties into labels. It was already in list format, so the databind was a snap.
If code would benefit anyone else, I'll post it -- I just didn't feel like cutting out all the extra CSS. ;)
Thanks to everyone who tried to help with this!

Ideas - storing jquery parameters for later use in partial view

Ok, let me try to clearly explain what I'm attempting to accomplish here.
Basically, I have a site that is using a liberal dose of jquery to retrieve partialviews into a consolidated 'single view'. So far so good - it all works great and is very performant.
However, I would like to have the ability to 'flag' (using a button) any such set and as a consequence of flagging it, add it to a functional area that I have dubbed 'active-tasks'. What I'd like to do is to be able to then goto that 'active-tasks' panel and see a range of ui tabs that represented the consolidated views that I had added. Clicking on any tab would then re-invoke that consolodated view afresh with the parameters that had been used at the time of flagging it. This would therefore mean that I'd have to store the parameters (?) for creating that consolidated view, rather than the generated html (this part i can do at the moment).
So, any thoughts on how to elegantly store the code required to generate the consolidated view on clicking a tab button - no pressure :)
cheers - jim
Actually, after a minimal amount of research, it looks like the newly updated .data() jquery method (with the ability to add an object to the payload) may work for the above.
http://api.jquery.com/data/
basically, this allows you to add hash type keyed data to an id element for use later, so in my scenario above i could simply attach the parameters required to invoke the action method that related to my consolidated view on the tab.
I'll let you know how i progress with this...
jim

Categories