Main Site Documentation

Best way to present a table in .NETMF "WPF"


#1

I have an application I am doing that involves a large list of data. Rather than create a Text object for each line and adding it to a vertical StackPanel, is there a table-like element that I can use?


#2

Interested in this too, makes it more easy to arrange not only data, but also groups of content.


#3

Hi guys,

there were a book which covers a lot of questions regarding .Net MF (like WPF , graphic , SPI ,…)

Take a look here

There were also a google book preview , maybe you can catch the right chapter (Chapter 11 Graphics and Graphical User Interfaces) B)

I bought the first edition of this book and i’m totally satisfied


#4

It’d be better to write your own table creator. WPF for NETMF is terribly slow. It’s really too much for such small devices.


#5

Are you suggesting that he paint a table pixel by pixel? In full .NET painting the pixels of a bitmap is verrrrry slow.


#6

WPF on NETMF is entirely written in C# so you couldn’t make something that would run slower! You actually can tweak it to handle your application much faster than generic WPF.

A new graphical library is something we would love to make when we have free time. Maybe the community can collaborate on making something.


#7

Not done this before, I would love to help and gain some experience. What do you guys say? Shall we try? Is there someone with a bit more experience?


#8

“Foekie” first congratulation on becoming a senior member, you have exceeded 100 posts :wink:
We didn’t tell anyone this before but the membership status will get you more things and more support in future :slight_smile:

As for the library, you need to have a little experience but it can be done. The most difficult part is supporting touch but that can be done at the end.


#9

Check it out, looks like I’m second to the Senior Member club!

As for the issue, I ended up simply making a function to make a horizontal stackpanel with the label on one side and a value at the other. Yeah, yeah, I know. It’s really kludgey, but it does work, and I only need it to work for a bit until come up with something better.


#10

Thank you, doing my best :wink:

Could you share this?


#11

It’s nothing special.

This is really only intended for testing. It does work, but it doesn’t give you any easy way of changing the properties of the text after the function returns. (unless you get change row items through the row somehow)

Also, the orientation stuff is all hosed up. I was trying to get the stack panel in the center, with the label on the far left and the value on the far right, but I never spent enough time messing with it get that part of it finished.

You will also need to compile a tinyfont to use wtih this. I use TinyFontTool, from: http://informatix.miloush.net/Microframework/Utilities/TinyFontTool.aspx

		private StackPanel makeRow(string label, string value)
		{
			StackPanel row = new StackPanel(Orientation.Horizontal);
			row.Width = SystemMetrics.ScreenWidth - 22;
			row.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
			row.TouchDown += beep;

			Text labelT = new Text();
			labelT.Font = Resources.GetFont(Resources.FontResources.Arial14Normal);
			labelT.TextContent = label;
			labelT.ForeColor = Colors.Blue;
			labelT.SetMargin(10, 0, 0, 0);
			labelT.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Left;
			labelT.Width = 200;

			Text valueT = new Text();
			valueT.Font = Resources.GetFont(Resources.FontResources.Arial14Normal);
			valueT.TextContent = value;
			valueT.ForeColor = Colors.Blue;
			valueT.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Right;

			row.Children.Add(labelT);
			row.Children.Add(valueT);

			return row;
		}