Listbox or Listview or Gridview? - wpf

I am trying to achieve this.
I have a list of records (filenames) which I want to show in a list.
Anybody has any idea as to which control to use.
Regards,
Deepak

The information is right at your fingertips. You should learn to use Snoop. Aside from that, you should choose whatever control works best for you, which requires you to learn the difference between each. We can't really provide a good answer because there are many different ways this control could be implemented, and that's why WPF is so powerful.
Basically, you'll want to use a mixture of a Grid and ItemsControl. You can see the layout of the controls that are being used in this screenshot:

Related

Nested ListView Items - TreeView&ListView combined

The best way to show what I need is showing an image:
What is the easiest way to implement this kind of "nested ListView" - each Item can be expanded and has subitems. I want the hierarchy only to show on the first column as shown when any other solution can be accepted.
There are couple of ways to do it. I consider that you are good in WPF and easily check code and take idea from it because it is not easy to give code of your requirement here.
You must need to user Expander for expand and collapse functionality for the detail sections as per you image.
I am sharing some the links from where you can easily get what you want. It is not exact code which you can copy but it will give you basic structure of what you want.
Listview and Expander
Sample-1
Expander and DataGrid
Sample-1
Sample-2
You will enjoy working on this one.

When to use custom user controls

I've got a massive UI that I'm designing. The way that my employer wants it, there are at least 100 labels. Now, I've always thought that in cases like this, breaking up the UI into smaller custom controls was the ideal way to go. However, someone recently told me that custom controls are really only for code re-use. What is the actual suggested practice for this?
EDIT
The finished form will look like this:
Now, I'm using WPF for the UI, and I'm thinking of breaking this down into smaller bits.
Based on your image i see some repetitions, each of this repetitions could be a custom UserControl
But it depends on the usability is it easier to write a custom UserControl so do it but if it would reduce the readability of your code and it also adds additional complexity don't do it
here are an example of what could be separate UserControl's
the green ones are possible useful encapsulations of logic
the orange ones maybe need some not market stuff (don't know enough about your software)
the red ones are the maybe's based on the intern use (from the visual part they are repetitions so the should custom UserControl)
Since your UI is read-only, I'd suggest using a grid.
Are you new to WPF? To break the View into bits WPF offers you CustomControls and UserControls. They are two very similar things yet completely different from each other. CustomControls are Buttons, Labels, TextBoxes, DataGrids...etc. They are basically simple stand-alone controls. UserControls are groups of stand-alone controls serving a purpose such as example a Button and a ComboBox next to each other so user can select something in ComboBox and confirm that by clicking the Button.
If you wish to display data from database I suggest you DataGrid which will give you a table-alike look with rows and columns and all that. If you wish to place few buttons next to DataGrid on which the user may click to insert a new row or to edit a certain cell then I suggest you to wrap all that with a UserControl which you can reuse in other places where you have to display and change data from database too.
You should be using a datagrid and can customize its template to render individual cells as Textblock (lighter version of Label) from a rendering perspective. The main difference between Textblock and Label is very minor things such as access keys and disabled state behavior. But from a WPF object hierarchy - Textblocks are much lighter. But besides that point - from your employer perspective - once you have customized the grid template and render them (so as they look as textblocks/labels) - your employer should have no problems.
Also as somebody suggested above - if you want to logically break sections of the UI since they maybe coming from a different table in db - then User controls is the way to go (for maintainability of code)
Let me know if you are looking for more technical details or need help further technically.
There is nothing wrong in making and using custom controls or user controls or defining some data templates which will be reused depending on how your data is organized.
For sure the UI looks pretty messy and some sort of grid should be used with templates for example where there is similar data. I also have the suggestion and first think about the data and the functionality before starting and let the UI be driven by that. For sure you will the reuse controls/templates. If you think in front on the model and behavior the UI can afterwards more easily changed.
Create your viewmodel correctly, implement the functionality in commands, use bindings, after that the UI will come naturally, reuse controls, use several grids, make the UI more user friendly using several regions, tabs, windows or anything that makes the user more comfortable.

Silverlight - Highlight List<> of words/prhases within TextBox

I am new to Silverlight and have a requirement to highlight (or change font color) all words and phrases wtihin a TextBox that match a list of words/phrases. At first I though this would be easy, but the more I look into it, the more confused I get.
My goal is to write something reusable so I can also apply the logic to a RadGridView later. I've seen a few examples of stuff close to what I need, but it's beyond my Silverlight level at this point.
I want to write this myself to get a better understanding of how some of the Silverlight internals work. Can someone point me in the right direction of where to start on something like this? Should this be implemented in a control? Should I use a behavior? I'm using Silverlight 4.
Once I know where to start, I am sure I can get this done - with some help from you guys of course ;-)
Thanks,
-Scott
How about using the RadRichTextBox (I assume you have a licence for it as you mentionned the RadGridView)?
There's also a good sample project on Telerik forum that is doing exactly what you want to do.

What is the most appropriate WPF control for showing a (color) log?

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.

WinForms TreeView

I am looking for a WinForms treeview control with following requirements:
Should be not so hard to write code for it (most tree/list combinations are way too complicated)
Should have some sort of easy drag and drop capabilities (including a vista-explorer style drop marker)
Should be free or at least affordable
Should provide some freedom of text/color/style/etc. of the treenodes (classic "outlook bold with blue numbers style)
Any ideas?
thx
i would recommend http://www.lidorsystems.com/ !
Another interesting alternative is TreeViewAdv, as suggested in another thread.
C# replacement for standard Treeview?
I'm a big fan of SandGrid by Divelements. I use it for all my ListViews and TreeViews. It even supports both at the same time (a TreeView with columns). I find it easy to use and very fast.
I think the standard WinForms' treeview control will do everything on your list. I don't know what the second item refers to as I've not used Vista. It's declared as System.Windows.Forms.TreeView and is available in VS200*'s form designer. I can't think of any simpler way of doing tree views.

Resources