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

RadContextMenu For StackedBar Chart.

2 Answers 37 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Manishkumar
Top achievements
Rank 1
Manishkumar asked on 26 May 2011, 07:30 AM
Hi,
How can we Incorporate the RadContextMenu for StackedBar Chart.
I tried to use the example given in the help for Bar Chart, but result in invisible Bars with context menu is opening on right click of it.

Please let me know what are changes I need to do on the Style, so that the bars get visible.
Here is the code for the Style:

<Style TargetType="telerik:StackedBar" x:Key="CommonContextMenu">
           <Setter Property="Template" >
               <Setter.Value>
                   <ControlTemplate TargetType="telerik:StackedBar">
                       <Canvas Opacity="0" x:Name="PART_CanvasContainer">
                           <telerik:RadContextMenu.ContextMenu>
                               <telerik:RadContextMenu ItemClick="RadContextMenu_ItemClick">
                                   <telerik:RadMenuItem Header="Go To Home Page" />
                                   <telerik:RadMenuItem Header="Go To Employee Page" />
                               </telerik:RadContextMenu>
                           </telerik:RadContextMenu.ContextMenu>
                           <Rectangle x:Name="PART_DefiningGeometry" 
                                  Height="{TemplateBinding ItemActualHeight}"
                                  Width="{TemplateBinding ItemActualWidth}"
                                  Style="{TemplateBinding ItemStyle}"
                                  RadiusX="{StaticResource BarRadiusX}"
                                  RadiusY="{StaticResource BarRadiusY}" />
                           <Rectangle Height="{TemplateBinding ItemActualHeight}"
                                  Width="{TemplateBinding ItemActualWidth}"
                                  RadiusX="{StaticResource BarRadiusX}"
                                  RadiusY="{StaticResource BarRadiusY}"
                                  OpacityMask="{StaticResource BarOpacityMaskBrush}"
                                  Fill="{StaticResource BarMaskBrush}" />
                           <Rectangle Height="{TemplateBinding ItemActualHeight}"
                                  Width="{TemplateBinding ItemActualWidth}"
                                  RadiusX="{StaticResource BarRadiusX}"
                                  RadiusY="{StaticResource BarRadiusY}"
                                  Fill="{StaticResource BarTopMaskBrush}" />
                           <Canvas.RenderTransform>
                               <ScaleTransform x:Name="PART_AnimationTransform" ScaleY="0" />
                           </Canvas.RenderTransform>
                       </Canvas>
                   </ControlTemplate>
               </Setter.Value>
           </Setter>
       </Style>

Please reply as soon as possible.
Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Evgenia
Telerik team
answered on 28 May 2011, 10:29 AM
Hello Manishkumar,

Could you try to set this Style (taken from the latest version of the RadChart control):
<Style TargetType="telerikCharting:StackedBar">
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="telerikCharting:StackedBar">
                    <Canvas Opacity="0" x:Name="PART_MainContainer">
                        <Rectangle x:Name="PART_DefiningGeometry" 
                               Height="{TemplateBinding ItemActualHeight}"
                               Width="{TemplateBinding ItemActualWidth}"
                               Style="{TemplateBinding ItemStyle}"
                               RadiusX="{StaticResource BarRadiusX}"
                               RadiusY="{StaticResource BarRadiusY}" />
                        <Rectangle Height="{TemplateBinding ItemActualHeight}"
                               Width="{TemplateBinding ItemActualWidth}"
                               RadiusX="{StaticResource BarRadiusX}"
                               RadiusY="{StaticResource BarRadiusY}"
                               OpacityMask="{StaticResource BarOpacityMaskBrush}"
                               Fill="{StaticResource BarMaskBrush}"
                               Stroke="{StaticResource BarMaskStroke}"
                               StrokeThickness="{StaticResource BarMaskStrokeThickness}"/>
                        <Rectangle x:Name="PART_SelectedState"
                                   Height="{TemplateBinding ItemActualHeight}"
                                   Width="{TemplateBinding ItemActualWidth}"
                                   RadiusX="{StaticResource BarRadiusX}"
                                   RadiusY="{StaticResource BarRadiusY}"
                                   Fill="{StaticResource BarTopMaskBrush}" />
                        <Canvas.RenderTransform>
                            <ScaleTransform x:Name="PART_AnimationTransform" ScaleY="0"/>
                        </Canvas.RenderTransform>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

If the issue still occurs - I suggest that you open a new formal thread and send us a sample runnable project where it reproduces. This way we will be able to investigate it and help you.

Kind regards,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Manishkumar
Top achievements
Rank 1
answered on 30 May 2011, 08:08 AM
Hi Evgenia,
Thanks, It worked.
Tags
Chart
Asked by
Manishkumar
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Manishkumar
Top achievements
Rank 1
Share this question
or