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
955
ContextMenus in treeMap control
posted

I was playing with the samples.

One of the basic requirements is to be able to support context menus.

I did not see any examples with context menus. So I tried modifying the following, in the datadrilldown.xaml sample:

 

                                           <TextBlock Grid.Column="1"
                                                   x:Name="TextBlockRevenue"
                                                   FontWeight="Bold"
                                                   TextWrapping="Wrap"
                                                   DataContext="{TemplateBinding DataContext}"
                                                   Text="{Binding Path=Revenue, StringFormat='{}{0:C}'}" >
                                             <TextBlock.ContextMenu>
                                                <ContextMenu>
                                                    <MenuItem Header="My ConextMenu">
Foo_0</MenuItem>

                                                </ContextMenu>
                                            </TextBlock.ContextMenu>

                                        </TextBlock>

I also added the following  

<ig:XamTreemap.NodeBinders>
                <ig:NodeBinder TargetTypeName="Manufacturer"
                               ValuePath="Revenue"
                               TextPath="Name"
                               ItemsSourcePath="Products"
                               NodeStyle="{StaticResource ManufacturerNodeStyle}" >
                    <ig:NodeBinder.ContextMenu>
                        <ContextMenu IsEnabled="True" AllowDrop="True">
                            <ContextMenu.Items>
                                <MenuItem Header="My New ContextMenu">Foo_1</MenuItem>
                            </ContextMenu.Items>
                        </ContextMenu>
                    </ig:NodeBinder.ContextMenu>

                </ig:NodeBinder>

 

When I run the application, right-mouse-button click will not display the context menu.
The intellisense shows that the object.ContextMenu is understood and the xaml compiles. it just does not display at runtime.

It would have been great if the treeMap examples also included some context menu sample.
Would it be possible to get a simple complete example, ideally using the MVVM pattern.

Thank 

 

Parents Reply Children