BeginInsert Problem

6 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 19 Sep 2012 Link to this post

    Hi,

    i'm using the newest version of RadGridView. My Columns are:

    Button
    Button
    Simple Text Column
    Simple Text Column
    Simple Text Column
    ...

    Now i click on a Button in the Header and i start RadView.BeginInsert(); But the Focus is now on the buttons and i can't get
    out of them. It is unpossible to get into a TextColumn.

    <button... IsTabStop="False" Focusable="False" ...>

    I like to set the focus in the first textcolumn, but how?

    thanks
    best Regards
    rene

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Sep 2012 Link to this post

    Hi,

    I have tested invoking the BeginInsert() method on a Button click when the Button is placed in the column's header. A new row was added successfully.

    May I ask you to share a bit more details on your exact implementation so that I could reproduce the issue? 

    Greetings,
    Didie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 19 Sep 2012 Link to this post

    Hi,

    yes the row ill be added successfully, but the Focus is on the Button in the Row and i can't geht out. I have to focus an
    other column first, then press "Inster New Row" and then i can edit the row.
    <telerik:RadGridView x:Name="RadGridView1" Width="Auto" telerik:StyleManager.Theme="Metro" FontSize="14" Margin="0" CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed"
             AutoGenerateColumns="False" FontFamily="Calibri" IsReadOnly="False" CellValidating="RadGridView1_CellValidating" RowStyleSelector="{DynamicResource stadiumCapacityStyle}"
             Frid.Row="1" CanUserDeleteRows="True" Deleting="RadGridView1_Deleting">
      <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="" Width="*" Name="SaveButton" MinWidth="140">
           <telerik:GridViewDataColumn.CellTemplate>
             <DataTemplate>
                <StackPanel Orientation="Horizontal">
                   <Button VerticalAlignment="Bottom" BorderThickness="0" Height="Auto" HorizontalAlignment="Center" Name="Save_btn" Background="{x:Null}" Width="Auto"                                                                    
                           BorderBrush="Transparent" Margin="3,2,10,2" Click="Save_btn_Click" ToolTip="{Binding Source={StaticResource Lang}, XPath=VerbindungSave/@Header}" IsTabStop="False" Focusable="False">
                       <StackPanel Orientation="Horizontal">
                          <Image Width="26" Height="26" Source="/ITA-Packetverwaltung;component/Images/save.png" />
                       </StackPanel>
                       <Button.Template>
                          <ControlTemplate TargetType="Button">
                             <ContentPresenter Content="{TemplateBinding Content}" Cursor="Hand" />
                          </ControlTemplate>
                       </Button.Template>
                   </Button>
                   <Button VerticalAlignment="Bottom" BorderThickness="0" Height="Auto" HorizontalAlignment="Center" Name="test_btn" Background="{x:Null}" Width="Auto"
                           BorderBrush="Transparent" Margin="3,2,10,2" Click="Button_Click" IsTabStop="False" Focusable="False">
                       <StackPanel Orientation="Horizontal">
                          <Image Width="26" Height="26" Source="/ITA-Packetverwaltung;component/Images/testen.png" />
                       </StackPanel>
                       <Button.Template>
                          <ControlTemplate TargetType="Button">
                              <ContentPresenter Content="{TemplateBinding Content}" Cursor="Hand" />
                          </ControlTemplate>
                      </Button.Template>
                    </Button>                                                                                                                     
                 </StackPanel>
              </DataTemplate>
           </telerik:GridViewDataColumn.CellTemplate>
           </telerik:GridViewDataColumn>                                           
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Name, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungName/@Header}" Width="*" MinWidth="100" Name="ghgh" />
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Host, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungHost/@Header}" Width="*" MinWidth="100"/>
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Port, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungPort/@Header}" Width="*" MinWidth="60" />
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Mandant, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungMandant/@Header}" Width="*" MinWidth="60" />
             <telerik:GridViewDataColumn DataMemberBinding="{Binding Passwort, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungPasswort/@Header}" Width="*" MinWidth="60" />
             <telerik:GridViewDataColumn DataMemberBinding="{Binding RootUser, Mode=TwoWay}" Header="{Binding Source={StaticResource Lang}, XPath=VerbindungsRootUser/@Header}" Width="*" MinWidth="60" />
      </telerik:RadGridView.Columns>
    </telerik:RadGridView>

    I want to set the Focus in the frist TextColumn, Name="ghgh".

    ThanksRene
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 20 Sep 2012 Link to this post

    Hello,

    I have reproduced the situation you have. The focus is actually in the first cell of the newly created row. This cell is not editable though (you have the two buttons inside).

    In order to be able to edit immediately after the button is pressed and a row is added, then you should set the current column to be the first editable one. For example:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
                this.clubsGrid.CurrentColumn = this.clubsGrid.Columns[1];
                this.clubsGrid.BeginInsert();
    }

    I hope this helps.

    Regards,
    Didie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  6. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 20 Sep 2012 Link to this post

    Hi,

    i'm sorry but it's still the same problem....
    The Focus is still on the two buttons in the first column.

    Thanks
    rene
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 20 Sep 2012 Link to this post

    Hello,

     I have attached my test project for a reference so that you can check how the suggested approach works.

    Regards,
    Didie
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top
UI for WPF is Visual Studio 2017 Ready