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
205
FlataData:DimensionMetaData DispalyName and DisplayFormat not working except inside xamFeatureBrowser?
posted

Hi,

I am using xamPivotGrid to display a flat data source.  I modified the FeatureBrowser source code and used the FlatData:DimensionMetaData to define the "displayName" and DisplayFormat to get the display format I want for column header text and cell data.  this worked well inside the XamFeatureBrowser.

But when I took the same code out and build in another WPF app, this all stopped working.  Can someone help me resolve this? 

xaml and code behind are posted below. 

Thanks.

 

xaml:

<UserControl x:Class="Infragistics.Samples.WPF.xamFeatureBrowser.Samples.PivotGrid.Basic.DataSourceFlatDataXAML" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igPivot="http://schemas.infragistics.com/xaml" xmlns:FlatData="http://schemas.infragistics.com/olap"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/xamFeatureBrowser;component/Samples/Common/Themes/igTheme/IG.xamPivotGrid.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <Grid Margin="25"> <Grid.Resources> <!--#BEGIN SNIPPET#--> <FlatData:FlatDataConnectionSettings x:Key="FlatDataConnectionSettings" ItemsSource="{Binding}" /> <FlatData:FlatDataSource x:Key="FlatDataSource" ConnectionSettings="{StaticResource FlatDataConnectionSettings}" Cube="EPLoss" Rows="[EPTypeCode].[EPTypeCode],[EPAnnualTypeCode].[EPAnnualTypeCode],[FinancialPerspectiveCode].[FinancialPerspectiveCode]" Measures="ExpectedValue,StandardDeviation,EP1Loss,EP2Loss,EP3Loss,EP4Loss,EP5Loss,EP6Loss"> <FlatData:FlatDataSource.CubesSettings> <FlatData:CubeMetadata DataTypeFullName="Infragistics.Samples.WPF.xamFeatureBrowser.Samples.PivotGrid.Basic.EPLoss" DisplayName="Annul EP Loss Summary"> <FlatData:DimensionMetadata SourcePropertyName="ExpectedValue" DisplayName="AAL" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="StandardDeviation" DisplayName="Standard Deviation" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP1Loss" DisplayName="EP1 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP2Loss" DisplayName="EP2 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP3Loss" DisplayName="EP3 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP4Loss" DisplayName="EP4 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP5Loss" DisplayName="EP5 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EP6Loss" DisplayName="EP6 Loss" DisplayFormat="{}{0:C2}" /> <FlatData:DimensionMetadata SourcePropertyName="EPAnnualTypeCode" DisplayName="AggO/Occ" /> <FlatData:DimensionMetadata SourcePropertyName="EPTypeCode" DisplayName="EP Loss/TVAR Loss" /> <FlatData:DimensionMetadata SourcePropertyName="FinancialPerspectiveCode" DisplayName="Financial Perspective" /> </FlatData:CubeMetadata> </FlatData:FlatDataSource.CubesSettings> <FlatData:FlatDataSource.HierarchyDescriptors> <FlatData:HierarchyDescriptor SourcePropertyName="EPAnnualTypeCode"> <FlatData:HierarchyDescriptor.LevelDescriptors> <FlatData:HierarchyLevelDescriptor LevelName="AggOrOcc" LevelExpressionPath="EPAnnualTypeCode" /> </FlatData:HierarchyDescriptor.LevelDescriptors> </FlatData:HierarchyDescriptor> <FlatData:HierarchyDescriptor SourcePropertyName="EPTypeCode"> <FlatData:HierarchyDescriptor.LevelDescriptors> <FlatData:HierarchyLevelDescriptor LevelName="EP Loss/TVAR Loss" LevelExpressionPath="EPTypeCode" /> </FlatData:HierarchyDescriptor.LevelDescriptors> </FlatData:HierarchyDescriptor> <FlatData:HierarchyDescriptor SourcePropertyName="FinancialPerspectiveCode"> <FlatData:HierarchyDescriptor.LevelDescriptors> <FlatData:HierarchyLevelDescriptor LevelName="Financial Perspective" LevelExpressionPath="FinancialPerspectiveCode" /> </FlatData:HierarchyDescriptor.LevelDescriptors> </FlatData:HierarchyDescriptor> </FlatData:FlatDataSource.HierarchyDescriptors> </FlatData:FlatDataSource> <!--#END SNIPPET#--> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <igPivot:XamPivotGrid x:Name="pivotGrid" Grid.Column="0" AllowCompactLayout="true" DataSource="{StaticResource FlatDataSource}" /> <!--<Button Grid.Column="1" Click="Button_Click">Change View</Button>--> <igPivot:Expander Grid.Column="1"> <igPivot:XamPivotDataSelector x:Name="dataSelector" DataSource="{StaticResource FlatDataSource}" /> </igPivot:Expander> </Grid></UserControl>

code behind:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using Infragistics.Olap.FlatData;using System.Collections;using Infragistics.Olap.Xmla;using Infragistics.Olap;using Infragistics.Controls.Grids;namespace Infragistics.Samples.WPF.xamFeatureBrowser.Samples.PivotGrid.Basic{ /// <summary> /// Interaction logic for DataSourceFlatDataXAML.xaml /// </summary> public partial class DataSourceFlatDataXAML : UserControl { public DataSourceFlatDataXAML() { InitializeComponent(); //set the ItemsSource to some IEnumerable (this.pivotGrid.DataSource as FlatDataSource).ItemsSource = GenerateData(); } protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); pivotGrid.Loaded += new RoutedEventHandler(pivotGrid_Loaded); pivotGrid.Unloaded += new RoutedEventHandler(pivotGrid_Unloaded); pivotGrid.HeaderCellClicked += new EventHandler<PivotHeaderCellClickedEventArgs>(pivotGrid_HeaderCellClicked); } void pivotGrid_HeaderCellClicked(object sender, PivotHeaderCellClickedEventArgs e) { System.Diagnostics.Debug.Write(e.Cell.ToString()); } void pivotGrid_Unloaded(object sender, RoutedEventArgs e) { System.Diagnostics.Debug.Write(sender.ToString()); } void pivotGrid_Loaded(object sender, RoutedEventArgs e) { var ds = pivotGrid.DataSource as FlatDataSource; //ds.Rows.Clear(); //ds.Rows.AddRange(XmlaDataSource.GenerateInitialItems("[EPTypeCode].[EPTypeCode],[EPAnnualTypeCode].[EPAnnualTypeCode],[FinancialPerspectiveCode].[FinancialPerspectiveCode]")); //ds.Measures.AddRange(XmlaDataSource.GenerateInitialItems("ExpectedValue,StandardDeviation,EP1Loss,EP2Loss,EP3Loss,EP4Loss,EP5Loss,EP6Loss")); pivotGrid.MeasuresDropControl.Visibility = System.Windows.Visibility.Collapsed; //pivotGrid.FiltersDropControl.Visibility = System.Windows.Visibility.Collapsed; pivotGrid.RowsDropControl.Visibility = System.Windows.Visibility.Collapsed; pivotGrid.ColumnsDropControl.Visibility = System.Windows.Visibility.Collapsed; } void RowsAreaSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { System.Diagnostics.Debug.Write(sender.ToString()); } System.Collections.ObjectModel.ObservableCollection<EPLoss> GenerateData() { return new System.Collections.ObjectModel.ObservableCollection<EPLoss> { new EPLoss(){ EPAnnualTypeCode ="AGG", EPTypeCode = "EP", FinancialPerspectiveCode="GR", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "EP", FinancialPerspectiveCode="GU", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "EP", FinancialPerspectiveCode="NT", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "EP", FinancialPerspectiveCode="RT", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, //TVAR new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "TVAR", FinancialPerspectiveCode="GR", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "TVAR", FinancialPerspectiveCode="GU", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "TVAR", FinancialPerspectiveCode="NT", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="AGG", EPTypeCode = "TVAR", FinancialPerspectiveCode="RT", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, //OCC new EPLoss(){ EPAnnualTypeCode ="OCC", EPTypeCode = "EP", FinancialPerspectiveCode="GR", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "EP", FinancialPerspectiveCode="GU", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "EP", FinancialPerspectiveCode="NT", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "EP", FinancialPerspectiveCode="RT", ExpectedValue = 24612549.41, StandardDeviation =76149694, EP1Loss =888302691.297543, EP2Loss =777358633.147027, EP3Loss =583006513.564664, EP4Loss =370890199.462681, EP5Loss =263620544.821948, EP6Loss =125371622.519345 }, //TVAR new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "TVAR", FinancialPerspectiveCode="GR", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "TVAR", FinancialPerspectiveCode="GU", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "TVAR", FinancialPerspectiveCode="NT", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, new EPLoss{ EPAnnualTypeCode ="OCC", EPTypeCode = "TVAR", FinancialPerspectiveCode="RT", ExpectedValue = 80299643.3285151, StandardDeviation =114084568.134665, EP1Loss =1006111255.75471, EP2Loss =919054577.675989, EP3Loss =780711338.046536, EP4Loss =583707821.958813, EP5Loss =449954646.265521, EP6Loss =290628533.132485 }, }; } private void Button_Click(object sender, RoutedEventArgs e) { var ds = pivotGrid.DataSource as FlatDataSource; var firstItem = ds.Rows[0]; ds.Rows.RemoveAt(0); ds.Rows.Add(firstItem); } } public class EPLoss { public string EPAnnualTypeCode { get; set; } public string EPTypeCode { get; set; } public string FinancialPerspectiveCode { get; set; } public double ExpectedValue { get; set; } public double StandardDeviation { get; set; } public double EP1Loss { get; set; } public double EP2Loss { get; set; } public double EP3Loss { get; set; } public double EP4Loss { get; set; } public double EP5Loss { get; set; } public double EP6Loss { get; set; } }}

Parents
No Data
Reply Children