Summary and detail in listbox

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


source is available here


6 thoughts on “Summary and detail in listbox

  1. 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)


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

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

    in Page.xaml.cs

  3. 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)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s