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

TextBox Theme and Tab index?

7 Answers 181 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sundhar
Top achievements
Rank 1
sundhar asked on 28 Mar 2011, 11:33 AM
Hello Telerik ,
                                    I have two clarification in Telerik controls.
First one is,I want to set Telerik themes into my all UI controls including my standard TextBox. I am using in code behind 

StyleManager

 

 

.ApplicationTheme = new TransparentTheme();

 

it was working fine for all telerik controls..But the themes not applying for my standard TxtBox.I have many TextBox in My User interface.I want to set the same theme globally.How is possible?  give me more details....

Second one is, in my one UI contains Four Controls and one radGridView.The control tabindexes are 1 to 4 respectively.
also radgridview tabindex is 5. Here my problem is when using tab its goes correctly first four only.then its goes radgrid not radgrid first row.i want here tab goes radgridView first row.after if i again press tab it will go to second row.
How to set it? if u give sample it will more helpful for me....
 
                      <Label Content="Company" Height="24" Margin="6,12,0,0" Name="label1" VerticalAlignment="Top" FontSize="11" HorizontalAlignment="Left" Width="98" />
                <telerik:RadComboBox Margin="115,12,29,0" Text="{Binding Path=CompanyName,Mode=TwoWay,UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Name="rcboCompany" VerticalAlignment="Top" Height="24" FontSize="11" TabIndex="1" LostFocus="rcboCompany_LostFocus" />
                <Label Content="Ledger Code Number" Height="24" Margin="9,12,0,0" Name="label2" VerticalAlignment="Top" FontSize="11" Grid.Column="1" HorizontalAlignment="Left" Width="122" />
                <TextBox Height="24" Text="{Binding Path=LedgerCodeNumber,Mode=TwoWay,UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Margin="129,12,96,0" Name="txtLedgerCodeNumber" VerticalAlignment="Top" TabIndex="2" FontSize="11" Grid.Column="1" MaxLength="5" />
                <Label Content="Ledger Name" Height="24" Margin="6,48,0,0" Name="label3" VerticalAlignment="Top" FontSize="11" HorizontalAlignment="Left" Width="98" />
                <TextBox Height="24" Margin="115,48,29,0" Name="txtLedgerName" Text="{Binding Path=LedgerName,Mode=TwoWay,UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" VerticalAlignment="Top" TabIndex="3" MaxLength="100" FontSize="11" />
                <Label Content="Group Name" Height="24" Margin="9,46,0,0" Name="label4" VerticalAlignment="Top" FontSize="11" Grid.Column="1" HorizontalAlignment="Left" Width="113" />
                <telerik:RadComboBox Margin="129,48,15,0" Text="{Binding Path=GroupName,Mode=TwoWay,UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Name="rcboGroup" VerticalAlignment="Top" Height="24" FontSize="11" IsEditable="True" TabIndex="4" Grid.Column="1"/>
  
<telerik:RadGridView Margin="12,163,21,22" Name="rgrdLedgerView" AutoGenerateColumns="False" CanUserFreezeColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" ShowGroupPanel="False" MouseDoubleClick="rgrdLedgerView_MouseDoubleClick" RowDetailsVisibilityMode="Visible" IsReadOnly="True" IsFilteringAllowed="False" TabIndex="5" IsSynchronizedWithCurrentItem="False">
            <telerik:RadGridView.Columns>
             
                <telerik:GridViewDataColumn DataMemberBinding="{Binding CompanyName}" Header="Company Name" Width="130"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LedgerCodeNumber}" Header="Ledger Code Number" Width="100"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LedgerName}" Header="Ledger Name" Width="140"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding GroupName}" Header="Group Name" Width="130"/>

</telerik:RadGridView.Columns>
</telerik:RadGridView>
Thank you,,,

7 Answers, 1 is accepted

Sort by
0
Vladimir Zagorski
Telerik team
answered on 30 Mar 2011, 02:32 PM
Hello sundhar,

We provide a default styles for some of the standard Microsoft's controls like TextBox, CheckBox, RadioButton etc. in our themes. In order to apply these styles you will have to set the theme explicitely using the StyleManager:

<TextBox  telerik:StyleManager.Theme="Transparent"/>

or by creating a global style for the specific control:
 
<Window.Resources>
        <Style TargetType="TextBox" BasedOn="{StaticResource {telerik:ThemeResourceKey  ThemeType=telerik:TransparentTheme, ElementType=TextBox}}" />
</Window.Resources>

Per your second requirement you will need to predefine the default keyboard navigation behavior of the Tab key as demonstrated in the following blog post and also to remove the Background_Current border from the GridViewCell's template. You can find an example here.

Let me know if you have any questions with this matter.

Greetings,
Vladimir Zagorski
the Telerik team
0
sundhar
Top achievements
Rank 1
answered on 31 Mar 2011, 11:14 AM
Hello Vladimir Zagorski,
                                     Thanks for your quick reply...
My first problem is clear.but still second problem is not clear.
1.Actually my problem is tab key is not going to gridview row.In my userinterface contains two textbox,two combo box only.
pls look my XAML code in my lost post.
2.here i am using radgrid for displaying datas from database only.also here setting tab index for 1,2,3,4 for combo box,textbox,textbox,combobox  respectively.
3.finaly i have setting  tab index 5 for radgridview.
4.I am using tab only to move cursor from one control to another control.cursor is focus on first control when i am loading window.after i am pressing tab its go to correctly in next control.but not goes to radgridview.If data is having in radgrid its go to first row that thing is i want..

5.i am try to solve the problem but not tab goes correctly in radgrid first row...
6.so kindly give me any sample solution.
0
Vladimir Zagorski
Telerik team
answered on 01 Apr 2011, 10:23 AM
Hello sundhar,

Please find the attached sample project that illustrates a possible approach for handling this scenario using custom keyboard navigation provider.

Let me know if I can be of any futher assistance.

All the best,
Vladimir Zagorski
the Telerik team
0
sundhar
Top achievements
Rank 1
answered on 01 Apr 2011, 02:51 PM
Hello Vladimir Zagorski,
                                     I am very happy to seen your reply..Thank you very much

My problem is still exist...
       k let i explain detail..pls ignore all controls except radgridview.Actually my problem is keyboard focus not get in gridview row .
I have solve half of my problem from the link
http://www.telerik.com/community/forums/wpf/gridview/row-keyboard-focus.aspx

In my scenerio i am loading radgridview datails from database.after i am getting focus from assign below code 

this

 

 

.rgrdLedgerGroupView.ChildrenOfType<GridViewCell>().Last().Focus();

Here i want focus on my grid last row whenever grid got focus..The above code
is working fine..
   But if i have more records in gridview the focus is in middle row..(draw radgrid im small size then add more details..upto the scrollbar visible).
i want focus on last row of the grid..My code is below..

 

public partial class LedgerGroup 
    {
        public LedgerGroup()
        {
            InitializeComponent();
            this.Load();
        }
        public void Load()
        {
            LedgerGroupDAL userData = new LedgerGroupDAL();         
                this.rgrdLedgerGroupView.ItemsSource = userData.FetchAll();
         }
        private void rgrdLedgerGroupView_Loaded(object sender, RoutedEventArgs e)
        {
            this.rgrdLedgerGroupView.ChildrenOfType<GridViewCell>().Last().Focus();
         }
My DAL is:-
class LedgerGroupDAL
{
     public IQueryable<LedgerGroupsBO> FetchAll()
        {
                var result = from lg in db.LedgerGroups
                             select new LedgerGroupsBO
                             {
                                 LedgerGroupID = lg.LedgerGroupID,
                                 GroupName = lg.GroupName,
                                 GroupCode = lg.GroupCode
                             };
                return result;
        }
}
I think the problem comes from loading datas from Gridview.Bcoz After all datas loaded to grid then only we can assign focus..But here this.load and RowLoaded method working same time..
how to avoid this.. i want focus on last row on my grid whenever gridview got focus.
pls give me some suggession..
   Thank you.

0
Vladimir Zagorski
Telerik team
answered on 05 Apr 2011, 07:36 AM
Hello sundhar,

The focus is in the middle row in your case because of the virtualization of the grid and more specifically to the following line of code which returns the last visible cell in the grid:

this.rgrdLedgerGroupView.ChildrenOfType<GridViewCell>().Last().Focus();

In order to scroll to a particular row in the grid, you should use the ScrollIntoViewAsync method as described in our documentation.
Let me know if that works for you.


Regards,

Vladimir Zagorski
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sundhar
Top achievements
Rank 1
answered on 06 Apr 2011, 06:54 AM
Hello Vladimir Zagorski,

           Thank you.it was working fine............
0
sundhar
Top achievements
Rank 1
answered on 08 Apr 2011, 06:43 AM
Hello Vladimir Zagorski,
                  Sorry for asking again the same problem...
In this issue i want focus is last row of my Radgridview....
so i am using 
 

this

 

 

.rgrdLedgerGroupView.ScrollIntoViewAsync(this.rgrdLedgerGroupView.Items[this.rgrdLedgerGroupView.Items.Count - 1],

 

 

 

 

new Action<FrameworkElement>((f) =>

 

 

{

 

(f as GridViewRow).ChildrenOfType<GridViewCell>().Last().Focus();

 

 

}));
 
this code i am putting inside of dataloaded event..
It was working fine when i am loading UI .after i am adding one row the focus comes first row...
i don't no why it comes..
   i want every time focus is last row of my grid..
give me some solutions....
   Thank you....

Tags
General Discussions
Asked by
sundhar
Top achievements
Rank 1
Answers by
Vladimir Zagorski
Telerik team
sundhar
Top achievements
Rank 1
Share this question
or