# .NET and More > Silverlight >  Active control border

## staticbob

Guys,

Is it possible to change the border style of controls when they get focus? Ideally across the board, if not how would I do it for each control?

I have a Silverlight app that needs to be much more visually accessible than normal and need a much stronger highlight on active controls.

i need to do something like this for textbox, button, combobox, radiobutton, checkbox etc etc...



```
        public AccessibleTextBlock()
        {
            InitializeComponent();

            ContentSimpleText.GotFocus += (o, e) =>
            {
                ContentBorder.BorderThickness = new Thickness(2);
                ContentBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x00));

            };

            ContentSimpleText.LostFocus += (o, e) =>
            {
                ContentBorder.BorderThickness = new Thickness(0);
            };
```

Thanks
Bob

----------


## RobDog888

How about create a style template. Then bind each control to the appropriate style so its all centralized.

----------


## staticbob

Thanks Rob,

How do I do this? I've tried to add this button style definition into the APP.xaml, but I dont know how to make this onfocus only...



```
    <Application.Resources>
        <local:Datasources x:Key="AppDatasources" />
        <!-- added local reference to SilverlightAccessiblity (self)
        Set Local:datasources
        -->
        
        <Style x:Name="BorderStyle" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border BorderBrush="Fuchsia"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
```

Also, when I then try to apply this style on by button on the xaml I get "The property style was not found in type button"

                    <Button Content="press me" Grid.Row="2" style="{StaticResource Borderstyle}">
                        <interactivity:Interaction.Behaviors>
                            <behaviors:ScrollOnFocusBehavior/>
                        </interactivity:Interaction.Behaviors>
                    </Button>


Sorry, I have limited understanding of the fundamentals here. Could you explain where and how I should be pointing the controls to a style template and how I can just affect the onfocused border.

Thanks
Bob

----------

