This is a migrated thread and some comments may be shown as answers.
RadContextMenu in header
0 Answers 14 Views
This is a migrated thread and some comments may be shown as answers.
cielo valdoz
Top achievements
Rank 1
cielo valdoz asked on 29 Oct 2012, 06:38 AM
Hi,

I have a contextmenu in the header of a gridview, then inside the menuitem there's a checkbox wherein when selected it will call the command but it's not firing. I'm not sure if I have to include the AncestorLevel or use PlacementTarget.

VIEW
<telerik:GridViewDataColumn.Header>
                           <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding IsOpen, ElementName=radContextMenuLink, Mode=TwoWay}">
                               <telerik:RadContextMenu.ContextMenu>
                                   <telerik:RadContextMenu x:Name="radContextMenuLink" Placement="Bottom">
                                       <telerik:RadMenuItem>
                                           <telerik:RadMenuItem.Icon>
                                               <Image Source="/Merchandise_Link;component/Images/link-icon.png" Stretch="Uniform" />
                                           </telerik:RadMenuItem.Icon>
                                           <telerik:RadMenuItem.HeaderTemplate>
                                               <DataTemplate>
                                                   <CheckBox Name="chkHasLink" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView}, Path=DataContext.HasLinkChangedCommand, Mode=TwoWay}" CommandParameter="{Binding IsChecked, ElementName=chkHasLink}" />
                                               </DataTemplate>
                                           </telerik:RadMenuItem.HeaderTemplate>
                                       </telerik:RadMenuItem>
                                       <telerik:RadMenuItem>
                                           <telerik:RadMenuItem.Icon>
                                               <Image Source="/Merchandise_Link;component/Images/link-break-icon.png" Stretch="Uniform" />
                                           </telerik:RadMenuItem.Icon>
                                           <telerik:RadMenuItem.HeaderTemplate>
                                               <DataTemplate>
                                                   <CheckBox Name="chkNoLink" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView}, Path=DataContext.HasLinkChangedCommand}" CommandParameter="{Binding IsChecked, ElementName=chkNoLink}" />
                                               </DataTemplate>
                                           </telerik:RadMenuItem.HeaderTemplate>
                                       </telerik:RadMenuItem>
                                   </telerik:RadContextMenu>
                               </telerik:RadContextMenu.ContextMenu>
                           </ToggleButton>
                       </telerik:GridViewDataColumn.Header>

ViewModel

HasLinkChangedCommand = New DelegateCommand(Of Object)(AddressOf subHasLinkChanged)
Private Sub subHasLinkChanged(ByVal objLink As Object)
    'do something here
End Sub


Thanks,
Cielo

No answers yet. Maybe you can help?

Asked by
cielo valdoz
Top achievements
Rank 1
Share this question
or