Want to change RadEntry Border Color on focus without code behind file. To achieve this Focus event converted to Command and IsSelectedFocused Command is firing on focus. After this VisualElement is converted to RadEntry & BorderSyle.Color changed to Brown does not have any impact.
Secondly, RadEntry Trigger IsFocused also does not have any impact. Please advise, in this regards.
<
input:RadEntry
Style
=
"{StaticResource ProductLabelStyle}"
WatermarkText
=
"Product Name"
>
<
input:RadEntry.Behaviors
>
<
common:RadEventToCommandBehavior
EventName
=
"Focused"
Command
=
"{Binding IsSelectedFocused}"
/>
</
input:RadEntry.Behaviors
>
<
input:RadEntry.Triggers
>
<
Trigger
Property
=
"common:FocusElementHelper.IsFocused"
Value
=
"True"
TargetType
=
"input:RadEntry"
>
<
Setter
Property
=
"input:RadEntry.BorderStyle"
Value
=
"{StaticResource ProductEntryFocusBorderStyle}"
/>
</
Trigger
>
</
input:RadEntry.Triggers
>
</
input:RadEntry
>
private
IAsyncCommand<
object
> _isSelectedFocused;
public
IAsyncCommand<
object
> IsSelectedFocused => _isSelectedFocused ??=
new
AsyncCommand<
object
>(onSelectedFocus, canSelectedFocus);
private
Task onSelectedFocus(
object
arg)
{
if
(!(arg
is
FocusEventArgs focusEventArgs))
{
return
Task.CompletedTask;
}
if
(focusEventArgs.VisualElement
is
RadEntry radEntry)
{
radEntry.BorderStyle.BorderColor = Color.Brown;
}
return
Task.CompletedTask;
}