Visual Studio C#, WPF controls - c#

I'm making a simple program in Visual Studio C# for school and I'm using the WPF Controls. I'm making some type of monthly report that I need to visualize in a table with the columns that represent the days.
The problem is that I don't know which control to use. I tried with with the ListBox but it does not give a good result to me.
Thank you

Sounds like you either want a datagrid, or an itemscontrol with a custom paneltemplate and itemstemplate.
Edit: If you aren't serious about learning WPF, stick with winforms, the learning curve is far easier. If you want to do any serious user interface work tho, keep working to learn WPF.

So if I understand correctly you need a grid.
If you use .net 4 you got a build in DataGrid
If not download it from wpf toolkit or consider the use of listview with the view of a grid view

Related

Use datatemplate without listview

I would like to know if it's possible to use a data template and a list system without the listview controller on xamarin forms.
You can definitely roll your own controls that use the templating engine. It would just take a whole lot of additional work with custom renderers for each platform etc. If you want to look into that you can check out the source code for Xamarin Forms since it's open source to see how they implemented the ListView. I think the negative voting is because this is quite a broad question that doesn't have an easy answer.

Display data in a table in Universal App

I have been looking for a couple of days for a UWP control that has similar functionality as the WPF ListView, which allows me to create a table like appearance.
Is there a control like this in the UWP or not?
What I want to achieve is a SCRUM and Kanban overview for Jira Software. Maybe there are better options.
Microsoft has created an add-on control that fits this use case nicely, the DataGrid control from their community toolkit.
More details: https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/datagrid
It supports sorting, filtering, grouping, and can even generate columns automatically from supplied data.
There is a control such as that and it is called listview.
https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.listview.aspx
Maybe you could use GridView as well, there is a nice short tutorial on:
https://channel9.msdn.com/Series/Windows-10-development-for-absolute-beginners/UWP-040-Data-Binding-to-the-GridView-and-ListView-Controls

How to use C# with WPF

I want to create a UI for my application.
What really confuses me is how to actually do it. I know that Microsoft has introduced WPF.
I have also seen some examples, but what I am not getting is whether or not WPF a seperate language? How can I use C# with WPF?
Lets say I want the user to click on a browse button, select a file and display it's content on the UI. I want to do it using C# while WPF providing the UI, is this possible?
Any good resources for a newbie like me?
EDIT
What i didnt understand, will i use WPF for my UI or windows form for my UI while my actual code is in C# ?
I think i am being lost here ? WPF seems something else that supports c#. is that true ? i thought WPF was only for UI while the actual code would be in C# or VB.
I have taken wpf unleashed but it explains wPF and not how to use C# with it. Atleast in the starting chapters ?
I know i am being dumb here but i am really confused
Yes it is definitely possible. Take a look at this article about Mode-View-ViewModel (MVVM) from Microsoft, which is a good introduction to using Xaml (the markup language for WPF) with C#.
Since you are familar with WinForms I will explain it like this.
WinForms provides the GUI and it is similar to what WPF does.
WPF however mainly uses XAML, a markup language based on xml to design the visual elements. It is a presentation foundation on its own that could be used without XAML but it is certainly a big part of it.
When creating an application it will be either WPF or WinForms you can't combine the two (well easily anyway I know there are a few ways to get around it)
You can interact with WPF the same way you interact with WinForms elements.
You can create a Window. On there you can place a grid, where you can then place controls such as a button or textbox. Then in the code behind it is exactly the same as referencing a control in winforms. for example in the page_load function doing
txtInput.Text = "A String";
So what should you choose? (Please note I am about to give you a few things to compare I realize this hardly describes both technologies to its fullest)
WPF
Pros
- Great for visually appealing designs
- You have XAML based control over your visual elements. Meaning you can change the way your form looks by writing xaml instead of doing all through the visual studio IDE pressing buttons.
Cons
- Bit of a performance hog. It has come along way with .net 3.5 sp1 but still chews up quite a few resources
- Not as many controls built for it as WinForms, mainly because its a newer technology.
- Can become complex as syntax for binding information to controls doesn't include intellisense.
WinForms
Pros
- Familiar and well used technology so your development will be faster
- Better performance
- More controls built for it
Cons
- More effort to build a visually appealing design
- Its not new and exciting so to speak. I know we all like to learn new things :)
It is not a seperate language. WPF employs XAML, a derivative of XML, to define and link various UI elements. As in web development, both layouts and specific themes are well suited to markup, but XAML is not required for either. Indeed, all elements of WPF may be coded in a .NET language (C#, VB.NET). The XAML code can ultimately be compiled into a managed assembly in the same way all .NET languages are.
You can implement your requirement in easily WPF.
To get a hands-on in WPF start with this article, http://10rem.net/blog/2010/02/09/getting-started-with-wpf--hello-world-in-multiple-flavors
Happy coding..
WPF is part of .NET framework, so it's not related with specific programming language. Please read MSDN's "Introduction to WPF" - http://msdn.microsoft.com/en-us/library/aa970268.aspx

Which windows form control is best for presenting data in a tabular fashion?

I need to present the output on the form in rows and columns. Is there a control to make that task easier? I am using visual studio 2010 and coding in C#.
You're looking for DataGridView.
Which looks like so (don't worry, the colors are fully configurable (;):
And has many advances capabilities such as DataBinding and paging.
Here's a tutorial to get you started.
Though you asked about WinForms, if you use WPF, in WFP 4.0 (.NET 4) there's a DataGrid that you can use. It's quite flexible.

alternative to DataGridView in Win API

Somewhere on net on one Blog I read a sentence that is "DataGridView something like Boeing 777, but what is goal when I do not know how to fly.
Before I goo deep in creating my projects I wanna know is there alternative for DataGridView in C#.
Something like jQuery in WEB api.
The favors things which I am looking for is that is simple for using, if its posibile to be freeware and looks smoth and modern.
Best regards
Admir
If you want to fly one person across town you can learn to fly a Piper Cub. If you want to fly hundreds across an ocean you need to learn to fly a 777.
There are many ways of displaying data in WinForms applications; which one is best for you depends on what you're trying to do. If you want to show a fixed, non-editable, non-scrollable list of data you can use a DataList; simple and limited. If you want to add scrolling you can output the data to a scrolling textbox.
If you want to handle a scrolling grid of multiple rows with multiple, resizable, editable columns you will need to move to a DataGrid or DataGridView.
There are many alternatives to DataGridViews; simpler controls provide fewer features and more functional controls are more complex.
I have implemented the datagridview extensively as an unbound control in a windows forms project using Visual Studio 2008. Looking back, implementing this control has consumed a large amount of time, mostly because it is loaded with bugs and peculiar behavior that should have been fixed rather than just 'documented'. A good data grid control is essential to any application of substance. I would recommend looking for a third party alternative from a company that is more interested in getting it right rather than just getting something out there.
The DataGridView is perfectly easy to use without going too deep. If all you want to do is display data in a grid, create a DataGridView and turn off features like adding and editing rows. The fact that it's got all of these incredibly complex features is really only an issue when you start needing to use them - and in that case, you'll be glad you're using it.
DevExpress has a really good gridview.

Categories

Resources