ContextMenu on DataForm

2 posts, 0 answers
  1. Juan Fernando
    Juan Fernando avatar
    2 posts
    Member since:
    Aug 2011

    Posted 12 Nov 2014 Link to this post

    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
  2. Boris
    Admin
    Boris avatar
    276 posts

    Posted 14 Nov 2014 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top