EditorTemplate Focus

4 posts, 1 answers
  1. Adige S.p.A
    Adige S.p.A avatar
    8 posts
    Member since:
    Jul 2012

    Posted 03 Apr 2014 Link to this post

    I have defined two datatemplate:


    <DataTemplate x:Key="doubleTemplate">
            <local:DoubleTextBox propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded="Text"/>
        </DataTemplate>

    and
    <DataTemplate x:Key="usrDoubleTemplate">
            <GridName="gridRoot">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <local:DoubleTextBox propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded="Text"/>           
                <Label Loaded="LabelUnit_Loaded" Grid.Column="1" Margin="2,0" ContentStringFormat="[{0}]"
                       propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded="DataContext"/>
            </Grid>
        </DataTemplate>

    When enter in editing mode with keyboard, in the first Datatemplate takes the focus on the TextBox, in the second Datatemplate does not take the focus on the TextBox.

    The reason may be the grid?

    Any solutions?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 Apr 2014 Link to this post

    Hello,

    What is the result if you switch the way the DataTemplates are ordered? Does only the first DataTemplate take the focus on the TextBox? Would you please let me know how exactly have you defined the PropertyGrid and how do you use the DataTemplates?

    Regards,
    Didie
    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
  4. Adige S.p.A
    Adige S.p.A avatar
    8 posts
    Member since:
    Jul 2012

    Posted 09 Apr 2014 in reply to Dimitrina Link to this post

    The DataTemplates are defined as resources, than the order is not important. Yes, only the first Datatemplate take the focus on the TextBox.

    I have defined PropertyDefinition in code behind and to every PropertyDefinition is assigned the EditorTemplate with a DataTemplate defined in resources.
  5. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Apr 2014 Link to this post

    Hi,

    It seems you use your custom TextBox. I tested the with TextBox and I could not reproduce any problem. Please note I test with the latest version.

    The way I defined my PropertyGrid is as follows:
    <telerik:RadPropertyGrid x:Name="pg"AutoGeneratePropertyDefinitions="False">
        <telerik:RadPropertyGrid.PropertyDefinitions>
         <telerik:PropertyDefinition DisplayName="Address"
         GroupName="Personal Info" Binding="{Binding Address}" EditorTemplate="{StaticResource doubleTemplate}"/>
         <telerik:PropertyDefinition DisplayName="Address"
     GroupName="Personal Info" Binding="{Binding Address}" EditorTemplate="{StaticResource usrDoubleTemplate}"/>
         </telerik:RadPropertyGrid.PropertyDefinitions>
     </telerik:RadPropertyGrid>

    Please note I have used your DataTemplates with the only difference I use a TextBox instead of DoubleTextBox.

    Would you please test if you experience the same problem with a TextBox?

    Regards,
    Didie
    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.

     
Back to Top