OptionsView.HighlightFocusedItem property allows you to get or set whether focused layout items are highlighted according to the current skin. If the HighlightFocusedItem option is set to true, the layout item containing the focused control is painted according to the current skin.
At the same time, you can use Appearance.ControlFocused.BackColor property to override skin’s backcolor and set the one that suits your needs, giving your users a constant visual clue of where keyboard entry is going to, whatever the focused layout item is.
To achieve it, add a new ViewController with its target type set to ViewType.DetailView. Then, in OnActivated event, get the actual DetailView and set OptionsView.HighlightFocusedItem and Appearance.ControlFocused.BackColor properties for the DetailView’s LayoutControl.
public partial class HighlightFocusedItemController : ViewController
{
public HighlightFocusedItemController()
{
InitializeComponent();
RegisterActions(components);
TargetViewType = ViewType.DetailView;
}
protected override void OnActivated()
{
base.OnActivated();
DetailView lDet = View as DetailView;
if (lDet != null)
{
((LayoutControl)(((WinLayoutManager)(lDet.LayoutManager)).Container)).OptionsView.HighlightFocusedItem = true;
((LayoutControl)(((WinLayoutManager)(lDet.LayoutManager)).Container)).Appearance.ControlFocused.BackColor = System.Drawing.Color.FromArgb(255, 201, 84);
}
}
protected override void OnDeactivating()
{
base.OnDeactivating();
}
}
Run your application, open any DetailView and see how it looks like. Here you have the screenshots.
Focused item before adding the ViewController

Focused item after adding the ViewController

Keep in mind that OptionsView.HighlightFocusedItem is in effect when a skinning paint scheme is applied and the OptionsView.AllowItemSkining property is set to true.
Hi. Thank you for this article.
ReplyDeleteI would like to know why using ControlFocused.BorderColor, instead of ControlFocused.BackColor, doesn't work.
Thanks.
You can get very efficient in-context interactivity due to the video, audio, streaming and messaging components once you opt for services of offshore Flex web application development by Adobe Flex developer for professional web development.Edknt Media
ReplyDelete