How to make message entry/list/view in C# - c#

He I am a beginner to C# and I am working on a reaction manager plug-in for some bigger project. (Yes I am a intern)
Now I just can't find a way to create a view similar to this:
My full design:
How to realize this design? I cant find any default templates in the devexpress which are suitable for this. I come from php and in php I can use html. I am a beginner to C# and I don't have any clue on how t do this. Do I have to use canvas to literally draw this? OR is there a standard template I can use for this purpose.

You have many comment boxes that contain the same layout - a label comment text, author name, date, etc. There is no control that lays things out like that, you will have to make your own custom control (Project->Add User Control). This control will be a composite control - ie made up of other controls. Probably a label for each text field (comment, author, date, etc) laid out in the right places. Maybe call it CommentBox or something.
Then in the main form you now have available CommentBox controls which you can add to the form. Create a panel to put them in so you have many CommentBox controls in the panel, one for each comment (or maybe add them at runtime).
Now in WPF it's slightly easier because there is a StackPanel control that you can simply add controls to and it automatically arranges them vertically one beneath another in a stacked list. In fact your use case is exactly fitting what a StackPanel is for.
In WinForms there is no StackPanel, but you can use a normal Panel control*. It's just you'll have to position the CommentBox controls manually one beneath another. You will also need to set the AutoScroll property to true to turn on the vertical scroll bar if the content doesn't fit the view.
*or there's apparently an alternative How can I get a StackPanel-like layout in WinForms

Related

WPF Control Identification

Sorry but I am a newbie to WPF, I would really appreciate if you could help me-
Tag 1 in pic- Which control can I use to create a menu similar to that in the picture ? The closest I came was using a gridview within a listview but that ends up using a header for the gridview. Normal listview just highlights the entire strip and doesn't look good at all.
Tag 2 in pic // (No longer relevant, sorry)
Edit:
Looking for something simple like when using gridview with listview (as in pic below) there is automatically that standard window gradient & bevel effect etc. (As an idea, implementing it with buttons seems to cumbersome, first strip button border, then create all these effects.) So essentially anything already inbuilt in WPF.
Thanks for any help :-D !!!
ListBox or ListView are good controls to use. If it's just the 'pretty' factor you don't like, you can provide Templates to change the appearance. But functionally, ListBox and ListView provide the function of that menu.
When working with WPF, that should be your primary motivation when choose controls. What FUNCTIONS the way you want. You can always make it LOOK different with Templates, but getting the right FUNCTION is the primary goal for the control.

Edit the style/template of a control created from code-behind

I'm styling WPF's Calendar control and I've reached a point in XAML where there's a grid with no elements in it, just divided by rows and columns where the day numbers are.
I've snooped and decompiled (void PopulateGrids()) and have learned that in code-behind the Calendar is creating CalendarDayButton and feeding it to the grid.
I need to change the style/theme in-order to change the colors (of those CalendarDayButton) and I'm not sure how to do that.
I've tried applying a style to all CalendarDayButton in said grid, but that didn't work.
Any suggestions?
P.S. I'd rather stay away from code-behind because what I'm working on is a style in a resource-dictionary and not a user-control.
Go to the Microsoft page for Calendar Styles and Templates, copy the style code into your resources block and make changes as needed. If you need to create additional properties for settings etc then you can do so with an attached property, that way you don't need to create a new calandar control. If you're having difficulty figuring out which parts of the template correspond to things you're seeing on-screen then put a breakpoint in your code somewhere, add the calandar control variable name to your watch window and click on the little magnifying glass to bring up the WPF visualizer...that will let you traverse the visual tree and visually see which part of the control each section is rendering.

What would be the best course of action for display different form in a single Winform?

Here's a screenshot of my application:
Basically, depending on what option is selected I'd like to show another 'content' which can be a buttons, or forms or whatever.
What would be the best choice for this? Using MDI? I'm really new to this type of thing.
This scenario lends itself well to tab pages, as you'd find on a TabControl.
However, since you already have a mechanism for switching between the content, you might prefer to create a series of Panels whose Dock property is set to DockStyle.Fill. When the user clicks the appropriate heading, you simply need to show the appropriate panel and call BringToFront() on it. This is essentially what the tab control does internally, anyway.
Don't forget to use SuspendLayout() and ResumeLayout() appropriately to reduce flicker, which can be a huge problem in WinForms applications, especially when there are lots of controls.
You can position a TabControl where the buttons are not visible and control it from your buttons.

Winforms Creating Dropdown style panel

I am attempting to create my own custom Autocomplete style dropdown control in c# .net2.0. For speed of development I have built my control as a UserControl but have hit on an issue of doing it this way.
When the custom drawn dropdown gets drawn I have to resize the UserControl area to be able to display the list of options.
Ideally I want to be able to mimic the drodpown list behaviour in that the list of options is drawn 'floating' and is not constrained by the UserControls height and width (nor even the parent forms boundaries). A tooltip is another example of the unconstrained 'floating' that I desire.
The only way I can think of achieving this is to create on the fly a new form with no border or title bar and display this when the popup is required.
Is there a better (but also quick) way of doing this?
TIA
You would need to use a Form or NativeWindow to allow the control to float correctly. To make a form follow the control is easy enough but it is more difficult to implement and handle all of the focusing/hiding issues especially if you need seamless tabbing/key navigation.
You can try creating a control that is based off the ToolStrip Drop Down Button control. I believe that this control has the functionality that you are looking for. I found this reference for creating controls based off the ToolStrip, you might try starting with this.
http://blogs.msdn.com/jfoscoding/attachment/1335869.ashx

Dynamic top down list of controls in WindowsForms and C#?

In our project, SharpWired, we're trying to create a download component similar to the download windows in Firefox or Safari. That is, one single top down list of downloads which are custom controls containing progress bars, buttons and what not.
The requirements are that there should be one single list, with one element on each row. Each element must be a custom control. The whole list should be dynamically re-sizable, so that when you make it longer / shorter the list adds a scroll bar when needed and when you make it thinner / wider the custom controls should resize to the width of the list.
We've tried using a FlowLayoutPanel but haven't gotten resizing to work the way we want to. Preferably we should only have to set anchoring of the custom controls to Left & Right. We've also thought about using a TableLayoutPanel but found adding rows dynamically to be a too big overhead so far.
This must be quite a common use case, and it seems a bit weird to me that the FlowLayoutPanel has no intuitive way of doing this. Has anyone done something similar or have tips or tricks to get us under way?
Cheers!
/Adam
If you don't want to use databinding (via the DataRepeater control, as mentioned above), you could use a regular Panel control and set its AutoScroll property to true (to enable scrollbars).
Then, you could manually add your custom controls, and set the Dock property of each one to Top.
.NET 3.5 SP1 introduced a DataRepeater Windows Forms control which sounds like it'd do what you want. Bind it to the list of "downloads" (or whatever your list represents) and customize each item panel to include the controls you need.

Categories

Resources