No Cursor in DataField

4 posts, 1 answers
  1. Harald
    Harald avatar
    48 posts
    Member since:
    Oct 2013

    Posted 03 Jul Link to this post

    Hi, i am using the DataForm. In edit mode i can not set the cursorposition in the DataField with left Mouseclick. How can I change this?
  2. Harald
    Harald avatar
    48 posts
    Member since:
    Oct 2013

    Posted 04 Jul Link to this post

    When i set AutoGenerateFields="True" and using no DataTemplate it works. After i set AutoGenerateFields="False" and using the Templates it does not work.

     

    01.<DataTemplate x:Key="WriteTemplate">
    02.                <Grid>
    03.                    <Grid.ColumnDefinitions>
    04.                        <ColumnDefinition Width="150"></ColumnDefinition>
    05.                        <ColumnDefinition Width="*"></ColumnDefinition>
    06.                    </Grid.ColumnDefinitions>
    07.                    <Grid.RowDefinitions>
    08.                        <RowDefinition Height="35"></RowDefinition>
    09.                        <RowDefinition Height="35"></RowDefinition>
    10.                        <RowDefinition Height="35"></RowDefinition>
    11.                        <RowDefinition Height="35"></RowDefinition>
    12.                        <RowDefinition Height="35"></RowDefinition>
    13.                    </Grid.RowDefinitions>
    14.                    <Label Grid.Row="0" Grid.Column ="0" Margin="0,5,0,0">Katalogeintrag:</Label>
    15.                    <Label Grid.Row="1" Grid.Column ="0" Margin="0,5,0,0">Katalogwert:</Label>
    16.                    <Label Grid.Row="2" Grid.Column ="0" Margin="0,5,0,0">Gültig ab:</Label>
    17.                    <Label Grid.Row="3" Grid.Column ="0" Margin="0,5,0,0">Gültig bis:</Label>
    18.                    <Label Grid.Row="4" Grid.Column ="0" Margin="0,5,0,0">Gesperrt:</Label>
    19.                    <telerik:DataFormDataField Grid.Row="0" Grid.Column ="1" DataMemberBinding="{Binding Name , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Mode="Edit" Margin="0,-22,0,0"/>
    20.                    <telerik:DataFormDataField Grid.Row="1" Grid.Column ="1" DataMemberBinding="{Binding Value , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,-22,0,0"/>
    21.                    <telerik:DataFormDateField Grid.Row="2" Grid.Column ="1" DataMemberBinding="{Binding Start , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,-22,0,0"/>
    22.                    <telerik:DataFormDateField Grid.Row="3" Grid.Column ="1" DataMemberBinding="{Binding End , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,-22,0,0"/>
    23.                    <telerik:DataFormCheckBoxField Grid.Row="4" Grid.Column ="1" DataMemberBinding="{Binding Locked , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,-22,0,0"/>
    24.               </Grid>
    25.            </DataTemplate>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 06 Jul Link to this post

    Hello Harald,

    The behavior you're experiencing is due to the fact that the negative margins that have been set for the RadDataForm fields contradict with the fixed heights you have set for your RowDefinitions' heights.
    Here's an example of how to define your DataTemplate, so that it can correctly focus the fields:

    <DataTemplate x:Key="WriteTemplate">
        <StackPanel Orientation="Vertical">
            <telerik:DataFormDataField Label="Name" DataMemberBinding="{Binding Name , Mode=TwoWay}"/>
     
            <telerik:DataFormDataField Label="Number" DataMemberBinding="{Binding Number , Mode=TwoWay}" />
     
            <telerik:DataFormDateField Label="Position" DataMemberBinding="{Binding Position , Mode=TwoWay}" />
     
            <telerik:DataFormDateField Label="Country" DataMemberBinding="{Binding Country , Mode=TwoWay}" />
        </StackPanel>
    </DataTemplate>

    If you would, however, like to go with the approach you have so far, you will need to either remove the negative margins or increase the RowDefinitions' heights so that they can fit the RadDataForm fields.

    I hope this solves your issue. Do let me know how this goes.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  5. Harald
    Harald avatar
    48 posts
    Member since:
    Oct 2013

    Posted 06 Jul in reply to Dilyan Traykov Link to this post

    Thank you.
Back to Top