I have a large number of classes and need to provide an edit interface for the fields in each of the classes. Is there a quick way to do this? This is more for troubleshooting/testing, so I could care less what it actually looks like and am not worried about validation, either.
It sounds to me like a job for a PropertyGrid control.
http://msdn.microsoft.com/en-us/library/system.windows.forms.propertygrid.aspx
Introduction with screenshots (may be easier to conceptualize thanthe MSDN link.)
Related
I would like to know how you are Design your Qooxdoo Code.
I don't get the right Architecture which I am satisfied with.
It is hard to encapsulate the View with logic like services.
I hope someone can give me a hint to a Pattern or something to find a good solution.
One of Qooxdoo's greatest features is a strong OO class system, so really the pattern that you use is up to you - MVC, MVVC, etc are all possible because Qooxdoo's OO system provides you the tools to implement your preferred pattern(s).
One pattern that I find very useful, especially in creating larger apps, is to define custom widgets for editing models; for example, if you have models (aka "Business Objects" etc) for Customer, Invoice, InvoiceLine, and Address having a widget for CustomerEditor, InvoiceEditor, InvoiceLineEditor, etc is really useful firstly because it encapsulates the code, but also because it supports binding.
Binding is a very powerful feature of Qooxdoo - to see why, let's assume for a moment that each one of your Editor widgets has a property called value which is the thing being edited.
In simple binding, your editor can bind properties of the model to the widgets which display and edit those properties, eg CustomerEditor bind value.firstName and value.lastName to a couple of qx.ui.form.TextField and automatically changes to the customer's firstName or lastName will be updated in the two TextField's. Binding can work the other way around too, so that changes to the TextField are copied back into the model.
There is a controller class called qx.data.controller.Form that can simplify making this happen, and optionally incorporate validation of user values and user feedback too.
If you have separate Editor widgets, you can also bind to them - for example, Customer could bind value.address to an instance of AddressEditor, and InvoiceEditor could bind the currently selected InvoiceLine to InvoiceLineEditor etc
what would be the best components to create a query builder? I imagine I'll need some sort of grid control. 30x30 cells perhaps. I would also love to have a snap-to-grid functionality as well. I'll be parsing the contents of the grid to create the queries so if I can iterate through the cells it would be a great help to. I'd be more than happy to post a sample project for anyone else to use if you all could help me with the base requirements. Thanks!
If you are already using the Telerik components for Silverlight, what about the RadExpressionEditor or RadDataFilter don't fit the requirements for what you're looking to do? Just curious as they are meant to handle this type of scenario.
ExpressionEditor allows for typing, which may not be the ideal if you're looking for a less error-prone scenario (aka, you don't trust users to write queries):
http://demos.telerik.com/silverlight/#ExpressionEditor/FilteringGridView
Otherwise DataFilter lets users select options based on the items and their respective types found in your collection, so it is much harder for a difficult user to break ;D :
http://demos.telerik.com/silverlight/#DataFilter/FirstLook
Is neither of those fit the bill, can you post more info in regards to your scenario/what you're looking to accomplish (and why you're looking at a 30x30 grid setup for the basis) and we might be able to brainstorm something good up. :)
-Evan
I want to extend Shapes.Rectangle WPF built-in class with some additional proprietary properties. I can do this in 3 different ways:
Declare my own wrapper class and have WPF Rectangle as one of its members.
Declare my own struct/class with my proprietary properties and put it in Rectangle.Tag field.
Declare WPF dependency property for each of my proprietary properties and use Rectangle.SetValue() & Rectangle.GetValue() methods.
What is the best approach from performance point of view (speed, memory consumption), giving that at every moment only part of my proprietary properties will have meaningful value ?
Thanks.
You can Create a Behavior that extends Behavior.
That's the best and easiest way (and Blend friendly) to add behavior to existing elements.
It's part of WPF4 now, and you can use it after u add a reference to System.Windows.Interactivity.
Are you going to be using your "sort of" derived Rectangle everywhere, or is it going to sometimes be a Rectangle and sometimes yours?
If you're going to be using some of your properties every single time, I would say you should create a wrapper class and just keep it as lightweight as possible. That'll keep your code as clean as possible. I don't think the performance will be an issue unless you're doing thousands of these. And if you are, then you might have other issues! :)
In WinForms I would use the rich text box to show the live output from msbuild. The performance wasn't that great with large amounts of text.
Does WPF have a better performing control? Any techniques to make it perform well?
Thanks in advance!
I would consider RichTextbox and FlowDocument. But it's also possible to get colored items in a ListBox.
Expected performance: better than in WinForms.
I would take a look at FlowDocument and FlowDocumentScrollViewer. Here is a nice FlowDocument overview. Also, take a look at this question for tips on optimizing the performance.
It depends on what you need.
If it needs to look and act like a textblock, you might need to stay with a document based thing.
But if your log is "record" based, where each log message is a "record", then a ListView might be a better use. You can style individual records in the listview differently using datatemplates, and the ListView supports virtualization, which could help with performance, at least in some ways. This would make it easier to show warnings and errors different than other things, you could use collectionviewsource for sorting and grouping, etc.
Is there a simple way to format numbers in a Winforms 1.1 datagrid? The Format property of the DataGridTextBoxColumn seems to be completely ignored. I know there is a solution that involves subclassing a Column control, and it's fairly simple, but was hoping there might be some trick to making the Format property just work.
My personal opinion is that a datagridcolumnstyle is the way to go. Without seeing the code that you have, I can't say for certain why your formatting isn't taking hold when no style is defined - but mixing in formatting with data calculations and other parts of the code can get very messy very quickly.
Creating a new column style class is very clean, and if you have to use the same formatting again in another datagrid, it's as easy as pie to reuse it.
Here's the Microsoft Documentation that may get you started in the right direction.
I did subclass and it was easy and did work. I still don't like it so much. I was already subclassing column styles for other reasons. I'd rather handle all databinding myself, where I can more easily change it and test it. This whole mixing of the UI with the data is old school, and not in a good way.
Thanks very much for your answers, it's good to have second opinions.
Mike