none
Duplicate Groups in DataGrid

    Pregunta

  • Hi there !

    I have some code in Silverlight 3:

    this.m_rawPacketsView.GroupDescriptions.Add(new PropertyGroupDescription("PacketType", new PacketTypeConverter()));


      This is my converter:

     

        public class PacketTypeConverter : IValueConverter
        {
            public enum TUPacketType
            {
                GpsOrig = 1,
                Histogram = 0x8,
                AETR = 0x9,
                Calibration1 = 0xc,
                Calibration = 0xd,
                WorkMinute = 0xa,
                Ignition = 0xb,
                Driver1 = 0x12,
                Driver = 0x13,
                Gps = 0x20,
                NotInterpreted = 0x28,
                Alarm = 0xab,
                Parameter = 0xb0,
                Temperature = 0xb1,
                Illegal = 0xF0
            }
    
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                byte? type = value as byte?;
                TUPacketType packetType = (TUPacketType)type;
                switch (packetType)
                {
                    case TUPacketType.GpsOrig:
                    case TUPacketType.Gps:
                        return "GPS";
                    case TUPacketType.Histogram:
                        return "Histogram";
                    case TUPacketType.AETR:
                        return "AETR";
                    case TUPacketType.Calibration1:
                    case TUPacketType.Calibration:
                        return "Calibarion";
                    case TUPacketType.WorkMinute:
                        return "Job minute";
                    case TUPacketType.Ignition:
                        return "Ignition";
                    case TUPacketType.Driver:
                    case TUPacketType.Driver1:
                        return "Driver";
                    case TUPacketType.NotInterpreted:
                        return "Not interpreted";
                    case TUPacketType.Alarm:
                        return "Alarm";
                    case TUPacketType.Parameter:
                        return "Parameters";
                    case TUPacketType.Temperature:
                        return "Temperture";
                    default:
                        return "Other";
                }
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }

    And in the result i have duplicate group in datagrid

    why is this happening?

    viernes, 18 de febrero de 2011 9:21

Respuestas

  • Thank You for your time and answer ! I was able to find my mistake. I dont know why I wrote :

    this.m_rawPacketsView = new PagedCollectionView(this.m_memoryData.RawPacketTable, false, true);

    It should be ::

    this.m_rawPacketsView = new PagedCollectionView(this.m_memoryData.RawPacketTable, false, false);

    Best Regards

    miércoles, 23 de febrero de 2011 2:59

Todas las respuestas

  • Hi,

    I tried your converter on my side and it works well.

    can you post how did you define your PagedCollectionView and other related code.

     

    Best Regards,

     

    lunes, 21 de febrero de 2011 5:27
  • Thank You for your time and answer ! I was able to find my mistake. I dont know why I wrote :

    this.m_rawPacketsView = new PagedCollectionView(this.m_memoryData.RawPacketTable, false, true);

    It should be ::

    this.m_rawPacketsView = new PagedCollectionView(this.m_memoryData.RawPacketTable, false, false);

    Best Regards

    miércoles, 23 de febrero de 2011 2:59