This question is locked. New answers and comments are not allowed.
Setting display index in Grid Loaded event are not working. When i try to change the display Index for one column, changing display index for previous columns. How can i save the user level Grid settings and i need to set those settings when user comes back.
public static void GridViewLoaded(object sender, RoutedEventArgs eventArgs)
{
var appSettings = IsolatedStorageSettings.ApplicationSettings;
List<ReOrderColumnsDto> results;
ReOrderColumnsDto poLineItemsColumnOrder = null;
if (IsolatedStorageSettings.ApplicationSettings.Contains("ReOrderColumns"))
{
results = (List<ReOrderColumnsDto>)appSettings["ReOrderColumns"];
if (results.Count() > 0 && ((GridViewDataControl)(sender)).Name.ToString() == "PODetailsLineItemsGridView")
{
poLineItemsColumnOrder = results.Where(x => x.UserPreferenceTypeId == (int)ReOrderColumnsEnum.PoLineItemsGrid).FirstOrDefault();
}
}
var columnOrderList = poLineItemsColumnOrder != null ? poLineItemsColumnOrder.Preferences.Split(',') : null;
var count = ((GridViewDataControl)(sender)).Columns.Count;
for (var i = 0; i < count; i++)
{
((GridViewDataControl)(sender)).Columns[i].DisplayIndex = Convert.ToInt32(columnOrderList[i]);
}
}
how can i set the display indexes for the grid columns.
public static void GridViewLoaded(object sender, RoutedEventArgs eventArgs)
{
var appSettings = IsolatedStorageSettings.ApplicationSettings;
List<ReOrderColumnsDto> results;
ReOrderColumnsDto poLineItemsColumnOrder = null;
if (IsolatedStorageSettings.ApplicationSettings.Contains("ReOrderColumns"))
{
results = (List<ReOrderColumnsDto>)appSettings["ReOrderColumns"];
if (results.Count() > 0 && ((GridViewDataControl)(sender)).Name.ToString() == "PODetailsLineItemsGridView")
{
poLineItemsColumnOrder = results.Where(x => x.UserPreferenceTypeId == (int)ReOrderColumnsEnum.PoLineItemsGrid).FirstOrDefault();
}
}
var columnOrderList = poLineItemsColumnOrder != null ? poLineItemsColumnOrder.Preferences.Split(',') : null;
var count = ((GridViewDataControl)(sender)).Columns.Count;
for (var i = 0; i < count; i++)
{
((GridViewDataControl)(sender)).Columns[i].DisplayIndex = Convert.ToInt32(columnOrderList[i]);
}
}
how can i set the display indexes for the grid columns.