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

ContextMenu on DataForm

1 Answer 66 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Juan Fernando
Top achievements
Rank 1
Juan Fernando asked on 12 Nov 2014, 04:01 PM
Hi

We have a problem with ContextMenu in a textbox when we try to use it inside a DataFormDataField, the items doesn't appears, just appear "Copy, Cut, Paste".
We did try populate the ItemsSource property from Opening Event and from a Binding, but doesn´t work
I attached a little example solution

And here some code, the textbox outside DataForm works perfect
<Grid>
        <Grid.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Styles.xaml"/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Grid.Resources>
       <telerik:RadDataForm x:Name="DataForm">
            <telerik:RadDataForm.ReadOnlyTemplate>
                <DataTemplate>
                <TextBox x:Name="textBox"
         Width="200" ContextMenu="{x:Null}"
         VerticalAlignment="Top" Margin="141,125,176,0">
                    <telerik:RadContextMenu.ContextMenu>
                        <telerik:RadContextMenu x:Name="ContextMenuHugo" ItemContainerStyle="{StaticResource MenuItemContainer}" Opening="ContextMenuHugo_OnOpening">
                                                   
                        </telerik:RadContextMenu>
                    </telerik:RadContextMenu.ContextMenu>
         
        </TextBox>
        </DataTemplate>
        </telerik:RadDataForm.ReadOnlyTemplate>
        </telerik:RadDataForm>
        <TextBox x:Name="textBox"
         Width="200" ContextMenu="{x:Null}"
         VerticalAlignment="Top" Margin="141,125,176,0">
            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu x:Name="ContextMenuHugo" ItemContainerStyle="{StaticResource MenuItemContainer}"
                                                >
 
                </telerik:RadContextMenu>
            </telerik:RadContextMenu.ContextMenu>
 
        </TextBox>
    </Grid>

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 14 Nov 2014, 04:55 PM

Hello Juan,

From your code-snippet I noticed that you are trying to put a TextBox as a ReadOnlyTemplate in the DataForm. By doing so the DataForm will not be able to show the your DataFormDataFields. In addition could you please share more details about your case and how you need to use the RadContextMenu in the DataFormDataFields?

For a more practical examples on how to use RadContextMenu you can check the ContextMenu SDK examples. Although GitHub is a very well-known platform we saw a better and easier approach for reviewing our examples by developing our SDK Samples Browser.

On a side note you mentioned that you have attached an example solution, however I was not able to find it.

We are looking forward to your reply.

Regards,

Boris
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DataForm
Asked by
Juan Fernando
Top achievements
Rank 1
Answers by
Boris
Telerik team
Share this question
or