This is a migrated thread and some comments may be shown as answers.

Fail to use "Apply" in CustomMapping when adapting the Windows 8 default theme in RadTreeMap

2 Answers 36 Views
TreeMap and PivotMap
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 30 Apr 2015, 11:24 PM

I have the following Apply method that has been working:

        protected override void Apply(Telerik.Windows.Controls.TreeMap.RadTreeMapItem treemapItem, object dataItem)
        {
            BranchIntegrationDetails details = dataItem as BranchIntegrationDetails;
            SolidColorBrush brush = PickBrush(details);
           
            // Apply the color
            treemapItem.Background = brush;            // Apply additional text
            IntegrationStatisticsControl statisticsControl = new IntegrationStatisticsControl()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Bottom,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                Foreground = ForegroundBrush,
                Margin = new System.Windows.Thickness(0,0,10,0)
            };
            statisticsControl.SetValue(Grid.RowSpanProperty, 2);
            Grid grid = treemapItem.ChildrenOfType<Grid>().ElementAt(1);
            grid.Children.Add(statisticsControl);
        }

The expected output can been in the first picture (see "expected.png").

 When I add the theme file into my app.xaml:

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="StyleResources.xaml" />
                <ResourceDictionary Source="TelerikTheme/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="TelerikTheme/Telerik.Windows.Controls.DataVisualization.xaml"/> <!-- this one is bad -->
                <ResourceDictionary Source="TelerikTheme/Telerik.Windows.Controls.Navigation.xaml"/>
            </ResourceDictionary.MergedDictionaries>

The control that I want to apply does not anymore (see "unexpected.png"). The same code is still working, I can see my control is added to the Grid, just I could not know why it is not showing.

2 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 01 May 2015, 08:25 PM

<ResourceDictionary Source="TelerikTheme/Telerik.Windows.Controls.DataVisualization.xaml"/>

 

The file is from c:\Program Files (x86)\Telerik\UI for WPF Q1 2015\Themes.Implicit\WPF40\Windows8\Themes\Telerik.Windows.Controls.DataVisualization.xaml

0
Sia
Telerik team
answered on 05 May 2015, 12:55 PM
Hello William,

There should not be such problems when using custom mapping. Since it is difficult to understand what causes your problems, please find attached the source code of our demo. If you manage to modify it in a way that your issue can be observed, it will be easy to find what goes wrong in your case.

As a small note, you need to change the order of merging the resource dictionaries. Please keep in mind that it should correspond to the dependencies between the telerik binaries as shown in our help.
Your custom styles should be merged after telerik resources and should be based on telerik styles.

Regards,
Sia
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
TreeMap and PivotMap
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Sia
Telerik team
Share this question
or