I get the following XML when I call XamDataGrid.SaveCustomizations(). Why do I get the second fieldlayout when the grid clearly has just one fieldlayout? Also, keys for these additional layouts are are empty strings. How do i prevent this from happening?
"<?xml version=\"1.0\" encoding=\"utf-8\"?><xamDataPresenter version=\"10.3.20103.2018\" formatVersion=\"1.6\">
<fieldLayouts>
<fieldLayout key=\"SitMessage\" fieldList=\"State;ObjectState, Key;Int64, TimeStamp;DateTime, MessageNumber;Int64, Source;DbItem, Destination;DbItem, ReceiveTime;DateTime, TransmitTime;DateTime, ModifiedSitType, BeaconId15Hex, Satellite;DbItem, Filename, Validity;SitValidity, NotificationText\">
<sortedFields>
<sortedField extendedInfo=\"TimeStamp;DateTime\" direction=\"Descending\" fieldName=\"TimeStamp\" isGroupBy=\"false\" />
</sortedFields>
<fields>
<field name=\"State\" extendedInfo=\"State;ObjectState\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Key\" extendedInfo=\"Key;Int64\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"TimeStamp\" extendedInfo=\"TimeStamp;DateTime\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"MessageNumber\" extendedInfo=\"MessageNumber;Int64\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Source\" extendedInfo=\"Source;DbItem\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Destination\" extendedInfo=\"Destination;DbItem\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"ReceiveTime\" extendedInfo=\"ReceiveTime;DateTime\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"TransmitTime\" extendedInfo=\"TransmitTime;DateTime\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"ModifiedSitType\" extendedInfo=\"ModifiedSitType\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"BeaconId15Hex\" extendedInfo=\"BeaconId15Hex\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Satellite\" extendedInfo=\"Satellite;DbItem\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Filename\" extendedInfo=\"Filename\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Validity\" extendedInfo=\"Validity;SitValidity\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"NotificationText\" extendedInfo=\"NotificationText\" cellWidthAuto=\"true\" labelWidthAuto=\"true\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" />
</fields>
</fieldLayout>
<fieldLayout key=\"\" fieldList=\"State;Object, Key;Object, TimeStamp;Object, MessageNumber;Object, Source;Object, Destination;Object, ReceiveTime;Object, TransmitTime;Object, ModifiedSitType;Object, BeaconId15Hex;Object, Satellite;Object, Filename;Object, Validity;Object, NotificationText;Object\">
<sortedField extendedInfo=\"TimeStamp;Object\" direction=\"Descending\" fieldName=\"TimeStamp\" isGroupBy=\"false\" />
<field name=\"State\" extendedInfo=\"State;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Key\" extendedInfo=\"Key;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"TimeStamp\" extendedInfo=\"TimeStamp;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"MessageNumber\" extendedInfo=\"MessageNumber;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Source\" extendedInfo=\"Source;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Destination\" extendedInfo=\"Destination;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"ReceiveTime\" extendedInfo=\"ReceiveTime;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"TransmitTime\" extendedInfo=\"TransmitTime;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"ModifiedSitType\" extendedInfo=\"ModifiedSitType;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"BeaconId15Hex\" extendedInfo=\"BeaconId15Hex;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Satellite\" extendedInfo=\"Satellite;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Filename\" extendedInfo=\"Filename;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"Validity\" extendedInfo=\"Validity;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" /> <field name=\"NotificationText\" extendedInfo=\"NotificationText;Object\" Visibility=\"Visible\" IgnoreFieldVisibilityOverrides=\"false\" />
</fieldLayouts>
</xamDataPresenter>
Also, grid gets into a state where it keeps adding feild layouts to the serialized string sometimes with empty keys. Other times, field layout being added is from the previous data type that was displayed in the grid. Please help.
Looks like XamDataGrid.SaveCustomizations() is not clearing some cache or buffer somewhere.
For example, this is my latest serialized string, even though I see FieldLayouts.Count ==1 just prior to calling XamDataGrid.SaveCustomizations().
<?xml version="1.0" encoding="utf-8"?>
<xamDataPresenter version="10.3.20103.2018" formatVersion="1.6">
<fieldLayout key="" fieldList="State;Object, Key;Object, TimeStamp;Object, Severity;Object, Source;Object, SourceType;Object, ProcessName;Object, Message;Object">
<sortedField extendedInfo="TimeStamp;Object" direction="Descending" fieldName="TimeStamp" isGroupBy="false" />
<field name="State" extendedInfo="State;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Key" extendedInfo="Key;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TimeStamp" extendedInfo="TimeStamp;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Severity" extendedInfo="Severity;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Source" extendedInfo="Source;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="SourceType" extendedInfo="SourceType;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ProcessName" extendedInfo="ProcessName;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Message" extendedInfo="Message;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<fieldLayout key="" fieldList="State;Object, Key;Object, TimeStamp;Object, MessageNumber;Object, Source;Object, Destination;Object, ReceiveTime;Object, TransmitTime;Object, ModifiedSitType;Object, BeaconId15Hex;Object, Satellite;Object, Filename;Object, Validity;Object, NotificationText;Object">
<field name="MessageNumber" extendedInfo="MessageNumber;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Destination" extendedInfo="Destination;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ReceiveTime" extendedInfo="ReceiveTime;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TransmitTime" extendedInfo="TransmitTime;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ModifiedSitType" extendedInfo="ModifiedSitType;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="BeaconId15Hex" extendedInfo="BeaconId15Hex;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Satellite" extendedInfo="Satellite;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Filename" extendedInfo="Filename;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Validity" extendedInfo="Validity;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="NotificationText" extendedInfo="NotificationText;Object" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<fieldLayout key="SitMessage" fieldList="ActionRequestedState;ObjectState, TimeStamp;DateTime, MessageNumber;Int64, Source;DbItem, SourceType;EntityType, Destination;DbItem, SitType;Int32, ModifiedSitType, TypeAlias;SitTypeAlias, Satellite;DbItem, SatelliteType;EarthOrbit, Validity;SitValidity, TransmitState;SITTransmitState, AuthStatus;SITAuthStatus, CommsHandler, ReceiveTime;DateTime, TransmitTime;DateTime, Direction;MessageDirection, NotificationText, BeaconId15Hex, Body;Object, Notification;SITNotification, State;ObjectState, IsActive;Boolean, Key;Int64, Filename, IsSelected;Boolean, IsActiveSelected;Boolean">
<field name="ActionRequestedState" extendedInfo="ActionRequestedState;ObjectState" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TimeStamp" extendedInfo="TimeStamp;DateTime" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="MessageNumber" extendedInfo="MessageNumber;Int64" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Source" extendedInfo="Source;DbItem" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="SourceType" extendedInfo="SourceType;EntityType" Visibility="Collapsed" IgnoreFieldVisibilityOverrides="false" />
<field name="Destination" extendedInfo="Destination;DbItem" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="SitType" extendedInfo="SitType;Int32" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ModifiedSitType" extendedInfo="ModifiedSitType" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TypeAlias" extendedInfo="TypeAlias;SitTypeAlias" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Satellite" extendedInfo="Satellite;DbItem" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="SatelliteType" extendedInfo="SatelliteType;EarthOrbit" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Validity" extendedInfo="Validity;SitValidity" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TransmitState" extendedInfo="TransmitState;SITTransmitState" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="AuthStatus" extendedInfo="AuthStatus;SITAuthStatus" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="CommsHandler" extendedInfo="CommsHandler" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ReceiveTime" extendedInfo="ReceiveTime;DateTime" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TransmitTime" extendedInfo="TransmitTime;DateTime" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Direction" extendedInfo="Direction;MessageDirection" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="NotificationText" extendedInfo="NotificationText" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="BeaconId15Hex" extendedInfo="BeaconId15Hex" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Body" extendedInfo="Body;Object" Visibility="Collapsed" IgnoreFieldVisibilityOverrides="false" />
<field name="Notification" extendedInfo="Notification;SITNotification" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="State" extendedInfo="State;ObjectState" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="IsActive" extendedInfo="IsActive;Boolean" Visibility="Collapsed" IgnoreFieldVisibilityOverrides="false" />
<field name="Key" extendedInfo="Key;Int64" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Filename" extendedInfo="Filename" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="IsSelected" extendedInfo="IsSelected;Boolean" Visibility="Collapsed" IgnoreFieldVisibilityOverrides="false" />
<field name="IsActiveSelected" extendedInfo="IsActiveSelected;Boolean" Visibility="Collapsed" IgnoreFieldVisibilityOverrides="false" />
Anyone there?
Even after clearing XamDataGrid.FieldLayout, when I call XamDataGrid.SaveCustomizations() I get the following XML. I NEED HELP HERE PLEASE.
<fieldLayout key="mySitMessage" fieldList="State;ObjectState, Key;Int64, TimeStamp;DateTime, MessageNumber;Int64, Source;DbItem, Destination;DbItem, ReceiveTime;DateTime, TransmitTime;DateTime, ModifiedSitType, BeaconId15Hex, Satellite;DbItem, Filename, Validity;SitValidity, NotificationText">
<sortedField extendedInfo="TimeStamp;DateTime" direction="Descending" fieldName="TimeStamp" isGroupBy="false" />
<fieldLayout key="SitMessage" fieldList="State;ObjectState, Key;Int64, TimeStamp;DateTime, MessageNumber;Int64, Source;DbItem, Destination;DbItem, ReceiveTime;DateTime, TransmitTime;DateTime, ModifiedSitType, BeaconId15Hex, Satellite;DbItem, Filename, Validity;SitValidity, NotificationText">
<field name="Key" extendedInfo="Key;Int64" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TimeStamp" extendedInfo="TimeStamp;DateTime" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="MessageNumber" extendedInfo="MessageNumber;Int64" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Source" extendedInfo="Source;DbItem" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Destination" extendedInfo="Destination;DbItem" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ReceiveTime" extendedInfo="ReceiveTime;DateTime" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="TransmitTime" extendedInfo="TransmitTime;DateTime" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="ModifiedSitType" extendedInfo="ModifiedSitType" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="BeaconId15Hex" extendedInfo="BeaconId15Hex" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Satellite" extendedInfo="Satellite;DbItem" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Filename" extendedInfo="Filename" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="Validity" extendedInfo="Validity;SitValidity" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field name="NotificationText" extendedInfo="NotificationText" cellWidthAuto="true" labelWidthAuto="true" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
<field nameSystem.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='ButtonNormalBackgroundFill'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='ExpanderShadowFill'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='ButtonNormalBackgroundFill'
="Notification" extendedInfo="Notification;SITNotification" Visibility="Visible" IgnoreFieldVisibilityOverrides="false" />
Also, if I do the following:
dataGrid.FieldLayouts.Clear();
dataGrid.DefaultFieldLayout = null;
Console.WriteLine("============= After clearing profile =========");
Console.WriteLine(dataGrid.SaveValidCustomizations());
I see the same layout I posted above. What is going on here guys?