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
3160
how to add displayformat in code?
posted

 

I need to add displayFormat to my measure in code as shown below.  Unfortunately it doesnt work....
What am I doing wrong?
The displayformat is correct when the measure is quantity but not when the measure is PctMktValue


http://help.infragistics.com/Help/NetAdvantage/WPFDV/2011.1/CLR4.0/html/xamPivotGrid_US_Defining_Hierarchies_And_Providing_Metadata_With_FlatData.html
http://community.infragistics.com/forums/t/69498.aspx


private void OnMeasureChanged(object sender, RoutedEventArgs e)
        {
            RadioButton radio = sender as RadioButton;
            ExposureGrid.DataSource.Measures.Clear();
            FilterHelper.FlatDataSource.CubesSettings.Clear();
           
            ExposureGrid.LayoutLoaded += new EventHandler<EventArgs>(ExposureGrid_LayoutLoaded);
            ViewModel.IsQuantityView = radio.Content.ToString() == "Quantity";
            string measureName = "Qty";
            string displayformat = "{}{0:#,#;(#,#)}";

            if (!ViewModel.IsQuantityView)
            {
                measureName = "PctMktValue";
                displayformat = "{}{0:#,#.##%;(#,#.##)%}"; // dosnt work
            }
           
            IMeasureViewModel measure = ExposureGrid.DataSource.CreateMeasureViewModel(ExposureGrid.DataSource.Cube.Measures[measureName]);
            DimensionMetadata dmd = new DimensionMetadata { DisplayFormat = displayformat, SourcePropertyName = measureName };
            CubeMetadata cmd = new CubeMetadata {DataTypeFullName = typeof(ExposureItem).FullName };
            cmd.DimensionSettings.Add(dmd);
            ExposureGrid.DataSource.Measures.Add(measure);
            ((FlatDataSource)ExposureGrid.DataSource).CubesSettings.Add(cmd);
        }

Parents Reply Children
No Data