Hi, I'm developing an RadWizard page with RadBusyIndicator control.
I've got the busy indicator that inside have the RadWizard so I have one busy indicator for all wizard pages.
At last page of wizard I've got an input and I would to set focus to it when the busy indicator finish. But it don't happen.
I've try the solution with FocusHelper.EnsureFocus but nothing happens.
I reproduce the case and attach the project here: https://we.tl/t-nPCbEFRtjw
How can I do this?
I notice that if the BusyIndicator is in WizardPage.Content than all work as aspected.
Thanks
4 Answers, 1 is accepted
Hello Enrico,
Thank you very much for the provided project.
It seems that due to some specific of the WPF framework, which I cannot pinpoint at the moment, the focus cannot be forwarded to the textbox with this setup.
I have, however, modified the project to achieve the desired result by moving the RadWizard out of the RadBusyIndicator and placing the RadBusyIndicator on top. Thus, the appearance of the controls remains identical, but now the focus can correctly be captured by the TextBox. Please note that I've also used the InvertedBooleanConverter for the binding to the EnsureFocus property to be fired as expected.
Please have a look at the updated project and let me know if the same approach would be applicable in your original application.
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Dilyan,
the solution you provided works very well.
I didn't think that BusyIndicator could be placed without elements inside.
Thanks
Hi Dilyan
I noticed that all works if in RadWizard I leave the proprierty:
FocusManager.FocusedElement=
"{Binding ElementName=txtUsername}"
<
Grid
>
<
telerik:RadWizard
x:Name
=
"radWizard"
IsContentPreserved
=
"true"
FocusManager.FocusedElement
=
"{Binding ElementName=txtUsername}"
SelectedPageIndex
=
"{Binding SelectedPage, Mode=TwoWay}"
>
<
telerik:RadWizard.WizardPages
>
<
telerik:WelcomeWizardPage
x:Name
=
"ChooseDBStep"
>
<
telerik:WizardPage.HeaderTemplate
>
<
DataTemplate
>
<
telerik:Label
x:Uid
=
"chooseProfile"
Content
=
"{x:Static l:LabelResources.chooseProfile}"
/>
</
DataTemplate
>
</
telerik:WizardPage.HeaderTemplate
>
<
telerik:WizardPage.Content
>
<
telerik:RadListBox
x:Name
=
"listDBConnections"
ItemsSource
=
"{Binding ListDBConnections}"
SelectedItem
=
"{Binding DBConnectionSelected, Mode=TwoWay}"
>
<
telerik:RadListBox.ItemTemplate
>
<
DataTemplate
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBlock
FontWeight
=
"Bold"
Text
=
"{Binding Name}"
/>
<
TextBlock
Grid.Row
=
"1"
Style
=
"{StaticResource SubTitle}"
Text
=
"{Binding Description}"
/>
</
Grid
>
</
DataTemplate
>
</
telerik:RadListBox.ItemTemplate
>
</
telerik:RadListBox
>
</
telerik:WizardPage.Content
>
<
telerik:WizardPage.FooterTemplate
>
<
DataTemplate
>
<
Border
Height
=
"40"
Margin
=
"-7"
>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Right"
Margin
=
"0,0,16,0"
>
<
telerik:RadButton
Content
=
"{x:Static l:LabelResources.Next_gt}"
Margin
=
"7,0,0,0"
MinWidth
=
"70"
IsDefault
=
"true"
IsEnabled
=
"{Binding IsDBConnectionSelected}"
Command
=
"{Binding TestConnection}"
BorderThickness
=
"0"
VerticalAlignment
=
"Center"
/>
<
telerik:RadButton
Content
=
"{x:Static l:LabelResources.Cancel}"
Margin
=
"7,0,0,0"
MinWidth
=
"70"
Command
=
"wizard:RadWizardCommands.Cancel"
BorderThickness
=
"0"
VerticalAlignment
=
"Center"
/>
</
StackPanel
>
</
Border
>
</
DataTemplate
>
</
telerik:WizardPage.FooterTemplate
>
</
telerik:WelcomeWizardPage
>
<
telerik:CompletionWizardPage
x:Name
=
"LoginStep"
ButtonsVisibilityMode
=
"Previous,Finish,Cancel"
>
<
telerik:WizardPage.HeaderTemplate
>
<
DataTemplate
>
<
Label
>Login</
Label
>
</
DataTemplate
>
</
telerik:WizardPage.HeaderTemplate
>
<
telerik:WizardPage.Content
>
<
Grid
>
<
StackPanel
Margin
=
"10"
>
<
Label
Content
=
"_Username:"
/>
<
TextBox
x:Name
=
"txtUsername"
Text
=
"{Binding UserToValidate.Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"
IsEnabled
=
"{Binding CanUserLogin}"
local:FocusHelper.EnsureFocus
=
"{Binding Loading, Converter={StaticResource InvertedBooleanConverter}}"
/>
<
Label
Content
=
"_Password:"
/>
<
telerik:RadPasswordBox
x:Name
=
"txtPassword"
WatermarkContent
=
"Inserire la password"
IsEnabled
=
"{Binding CanUserLogin}"
/>
<
ItemsControl
ItemsSource
=
"{Binding Errors}"
Grid.Row
=
"4"
Grid.ColumnSpan
=
"2"
TextBlock.Foreground
=
"Red"
IsTabStop
=
"False"
/>
</
StackPanel
>
</
Grid
>
</
telerik:WizardPage.Content
>
<
telerik:WizardPage.FooterTemplate
>
<
DataTemplate
>
<
Border
Height
=
"40"
Margin
=
"-7"
>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Right"
Margin
=
"0,0,16,0"
>
<
telerik:RadButton
Content
=
"{x:Static l:LabelResources.lt_Previous}"
MinWidth
=
"70"
IsEnabled
=
"{Binding CanUserLogin}"
Command
=
"{Binding CancelLogin}"
BorderThickness
=
"0"
VerticalAlignment
=
"Center"
/>
<
telerik:RadButton
Content
=
"{x:Static l:LabelResources.Login}"
Margin
=
"7,0,0,0"
MinWidth
=
"70"
IsDefault
=
"true"
IsEnabled
=
"{Binding CanUserLogin}"
Command
=
"{Binding ValidateLogin}"
CommandParameter
=
"{Binding ElementName=txtPassword}"
BorderThickness
=
"0"
VerticalAlignment
=
"Center"
/>
<
telerik:RadButton
Content
=
"{x:Static l:LabelResources.Cancel}"
Margin
=
"7,0,0,0"
MinWidth
=
"70"
Command
=
"wizard:RadWizardCommands.Cancel"
BorderThickness
=
"0"
VerticalAlignment
=
"Center"
/>
</
StackPanel
>
</
Border
>
</
DataTemplate
>
</
telerik:WizardPage.FooterTemplate
>
</
telerik:CompletionWizardPage
>
</
telerik:RadWizard.WizardPages
>
</
telerik:RadWizard
>
<
telerik:RadBusyIndicator
x:Name
=
"radBusyIndicator"
IsBusy
=
"{Binding OnLoading}"
BusyContent
=
"{Binding LoadingText}"
/>
</
Grid
>
Is correct?
Thaks
Hi Enrico,
Indeed, such an approach would also work but would limit you to having just one focused element. Of course, you can bind this by exposing another property in your viewmodel to hold the focused element if this suits your needs. You can also use an approach similar to the one suggested in this forum thread.
Nonetheless, I do hope you manage to achieve the desired result. If I can further assist you with anything else, please let me know.
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.