Summary and detail in listbox

Posted on March 31, 2008. Filed under: Silverlight | Tags: , , |

A couple of posts back we saw how to create a simple yet functional expander control. this sample shows how to use one of those in listbox. we will replace the listboxitem template with our expander control.

see a demo

summarydetail.jpg

source is available here

Make a Comment

Make A Comment: ( 6 so far )

blockquote and a tags work here.

6 Responses to “Summary and detail in listbox”

RSS Feed for Lee’s corner Comments RSS Feed

Your sample doesn’t work with non-english system locale settings. Just try to change Decimal symbol to comma for example (russian format: decimal symbol is comma, digit grouping symbol is space).

—————————
Windows Internet Explorer
—————————

Silverlight error message
ErrorCode: 4002
ErrorType: ManagedRuntimeError
Message: System.FormatException: Input string was not in a correct format.

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)

at System.Decimal.Parse(String s)

at slapp1.Page.b__4(Customer l)

at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()

at System.Linq.Enumerable.Sum(IEnumerable`1 source)

at slapp1.Page.Page_Loaded(Object sender, RoutedEventArgs e)

at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)

at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

—————————
OK
—————————

Hi,
Do you know how to fix it. I will make the change

Just change
decimal total = (from l in li select Decimal.Parse(l.Total)).Sum();

to
decimal total = (from l in li select Decimal.Parse(l.Total, System.Globalization.CultureInfo.InvariantCulture)).Sum();

in Page.xaml.cs

Thanks Oldlaurel, updated the code

very nice.
any chance of doing it in VB

GJ,
I did not do vb in sometime. I will give it a shot, but might take some time, did you try c# to vb converters(this might be faster)


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...