HI, I follow this
https://docs.telerik.com/devtools/xamarin/knowledge-base/slideview-access-parent-bindingcontext
for the BindingContext, but now I need to set the focus to a RadEntry inside a content view. The ViewModel call the function with the MessagingCenter, but I do not know how to access the RadEntry in the code behind.
View:
<
telerikPrimitives:RadSlideView
x:Name
=
"SlideView"
SelectedIndex
=
"{Binding SlideViewIndex}"
>
<
telerikPrimitives:RadSlideView.Commands
>
<
commands:CustomSlideViewCommand
Id
=
"SlidingToIndex"
Command
=
"{Binding BindingContext.SlidindToIndexCommand}"
/>
<
commands:CustomSlideViewCommand
Id
=
"SlidedToIndex"
Command
=
"{Binding BindingContext.SlidedToIndexCommand}"
/>
</
telerikPrimitives:RadSlideView.Commands
>
<
telerikPrimitives:RadSlideView.ItemsSource
>
<
x:Array
Type
=
"{x:Type ContentView}"
>
<
ContentView
x:Name
=
"Etape1CV"
>
<
StackLayout
Margin
=
"10"
x:Name
=
"Etape1SL"
>
<
Label
>Scanner ou entrer un code de localisation</
Label
>
<
Entry
x:Name
=
"TestEntry"
>ALLO</
Entry
>
<
telerikInput:RadEntry
x:Name
=
"CodeLoca"
WatermarkText
=
"Code"
IsTabStop
=
"True"
/>
</
StackLayout
>
</
ContentView
>
<
ContentView
>
<
Label
HorizontalOptions
=
"Center"
VerticalOptions
=
"CenterAndExpand"
Text
=
"Other View"
TextColor
=
"Blue"
/>
</
ContentView
>
<
ContentView
>
<
Label
HorizontalOptions
=
"Center"
VerticalOptions
=
"CenterAndExpand"
Text
=
"Another View"
TextColor
=
"Red"
/>
</
ContentView
>
</
x:Array
>
</
telerikPrimitives:RadSlideView.ItemsSource
>
</
telerikPrimitives:RadSlideView
>
CodeBehind
public
DecompteLocalisationView ()
{
InitializeComponent ();
BindingContextHelper.CurrentPageBindingContext =
this
.BindingContext;
MessagingCenter.Subscribe<
string
>(
this
,
"SetFocusToCodeLoca"
, (sender) => {
foreach
(ContentView View
in
SlideView.ItemsSource)
{
//CHECK THE VIEW NAME TO FIND ETAPE1CV
//THEN SET THE FOCUS
//RadEntry Tb = CodeLoca as RadEntry;
//Tb.Focus();
//if (Tb.Text.Length > 0)
//{
// Tb.CursorPosition = 0;
// Tb.SelectionLength = Tb.Text.Length;
//}
}
});
}
Thanks