Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3914
Format date dynamically
posted

Hi,

I am trying to format data dynamically, by allowing user to choose date format from context menu. The following is the event handler I use. When I debug I see that FlatDataSource is updated, but for some reason the grid is not updated. Could you please tell me what I am doing wrong. Or is this a bug?? Refreshing the grid doesn't seem to help.

 

private void QuickDates_Click(object sender, RoutedEventArgs e)
        {
            if (pivotGrid.DataSource != null)
            {
                MenuItem mi = sender as MenuItem;
                string dateFormat = mi.Header as string;

                FlatDataSource flatDataSource = pivotGrid.DataSource as FlatDataSource;
                int index = 0;
                foreach (DimensionMetadata metaData in flatDataSource.CubesSettings[0].DimensionSettings)
                {
                    if (metaData.SourcePropertyName.Equals("End Date"))
                    {
                        flatDataSource.CubesSettings[0].DimensionSettings[index++].DisplayFormat = dateFormat;
                        //metaData.DisplayFormat = dateFormat;                       
                        break;
                    }
                    index++;
                }

            }
        }

 

Thanks

Sangeetha