Can I cause a field to blink or otherwise display some special effects? RRS feed

  • Question

  • I have code working that changes the font, size and color of a control based on some conditional checks (like if one field is greater than another, change the color) but I can't find a listing anyplace that tells me every property of a field that can be changed in code.

    The code I'm using to change color and font is shown below.

    My question is... can I also make it blink?  If not... can I make the background one color and the foreground another?  Is there a list anywhere that shows all the possibilities?

    Dim controlProxy = Me.FindControl("PercentComplete")

                AddHandler controlProxy.ControlAvailable, _

                   Sub(sender As Object, e As ControlAvailableEventArgs)

                       Dim control = CType(e.Control, TextBlock)

                       With control

                           If (Me.Agreement.Planogram = True) _

                           AndAlso (Me.Agreement.CP2.HasValue) _

                           AndAlso (Me.Agreement.RP2.HasValue) _

                           AndAlso (Me.Agreement.CP2 > Me.Agreement.RP2) Then

                               .Foreground = New SolidColorBrush(Color.FromArgb(255, 255, 0, 0))


                               .Foreground = New SolidColorBrush(Color.FromArgb(255, 255, 255, 0))

                           End If

                           .FontSize = Convert.ToDouble(12.0)

                           .FontFamily = New FontFamily("Comic Sans MS")

                       End With

                   End Sub

    • Edited by Jyuma1 Friday, May 24, 2013 12:51 PM
    Friday, May 24, 2013 12:50 PM


All replies

  • Remember that all of these controls are just Silverlight controls, so you can check what properties are available for them by checking the Silverlight documentation.

    The other thing to do is grab a control in the ControlAvailable event, cast it to the correct type, then use Intellisense to see what you are offered. I learned all sorts of things that way :)

    Hope this helps.

    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Friday, May 24, 2013 3:01 PM
  • You can make it 'blink' by applying an animation in a loop.

    You should take a look at my VS gallery sample here as it does that:

    Control colors of DataGrid rows and other UI elements in LightSwitch

    Dave Baker | Xpert360 blog | twitter : @xpert360 | Xpert360 website Opinions are my own. For better forums, please mark as helpful/answer, if it helps/solves your problem.

    • Proposed as answer by Xpert360 Thursday, May 30, 2013 1:37 PM
    • Marked as answer by Angie Xu Thursday, June 6, 2013 12:45 AM
    Friday, May 24, 2013 4:08 PM