none
Free custom controls - static image viewer, labelled group, stylable label and stylable static label

    General discussion

  • Pixata Custom Controls for Lightswitch

    UPDATE 11th Oct '11 - Released version 1.8, minor modifications

    I have just published the latest version of the custom controls I wrote for Lightswitch. Please have a look, and see if you think these are useful. The controls are...

    Static image viewer: fed up with the amount of effort and code that takes to add a static image to a screen? So was I! This control makes it really easy to add static images to your screens without writing any code, and without having to add the images to your project manually (no more fiddling around in File View), and allows you to set an optional border and/or drop shadow - neither of which can be done at all using the standard method.

    Labelled group: I wanted a way to be able to place two textboxes (or other controls) together, say for someone's first name and surname, or other closely-related information. The standard Lightswitch stuff makes this extremely difficult, if not downright impossible to do. The labelled group control makes it very, very easy!

    Web link: If your data includes a URL, then you can display this as a link, which will open the URL in the user's default web browser. You can choose to display the text of the URL and/or an image.

    Stylable label: To be used in place of the standard label control, when you want to be able to set the font colour, size, bold, or text alignment for the label.

    Stylable static label: As above, but allows you to place static text on the screen, without needing to add a screen property for every piece of static text.

    Stylable textbox: Like a regular textbox, except that you can set the font size, bold and italic, border colour and background colour.

    Spacer: A really quick and easy way to add space between controls. Just set the height and/or width and you're done!

    Horizontal and Vertical dividers: If you want to add dividers between groups or controls, these two will do it for you. You just set the divider thickness and the colour. A great way to mark out sections of your screen if you don't have the space for a full group control, or if you just want a simple divider.

    I hope these controls are useful. If so, please rate them accordingly. If not, please let me know why, and I'll see if I can improve them.

    Pixata Custom Controls for Lightswitch


    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/

    • Changed type Mr Yossu Tuesday, October 04, 2011 4:49 PM
    • Edited by Mr Yossu Sunday, October 23, 2011 3:22 PM
    Tuesday, October 04, 2011 4:49 PM

All replies

  • Hi Mr Yossu,

    thank you very much for your great work!

    I think that this extension, like the one of Yann Duran, are "a must" for any Lightswitch developer, and if, whenever I will buy LS from Microsoft (at this time I use the trial), will be because I can use your extensions!

    Bye

    MauroBis

     

     


    MauroBis
    Tuesday, October 04, 2011 6:42 PM
  • Hi Mauro,

    Thanks for the kind words. I can't claim that my output is anything like Yann's, but I hope it's of use!


    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/
    Tuesday, October 04, 2011 8:16 PM
  • Oh.. man. If you release this yesterday or day b4 that... :) :)
    Amazing work Mr Yossu. Each one your (and other community releases) filling LS's void and that brings more & more joy developing. Keep them coming. So far I've used "Static Label" controls. Need some work to redesign my rest of the pages with your other controls. Sure this is gonna clean up a lot of mess in the viewmodel. Thank you so much!!

    -Bala
    Tuesday, October 04, 2011 9:20 PM
  • Thanks for the feedback PowerBala.

    I would have loved to have these controls out a few days ago, but was going round in circles trying to figure out how to get at embedded resources from the custom control. I only found out how to do it this morning, when Justin posted some really simple code (like a fraction of the code that I was playing with, and much more simple) that enabled me to finish off the static image viewer so quickly.

    I'm hoping to create some more controls soon, but first I have to catch up in the "real" work I've been neglecting over the past few days!

    Thanks again.


    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/
    Tuesday, October 04, 2011 9:55 PM
  • hi!

    very good and useful work!

    only one question: when i use your labeled group control, it seems that label of group is not in line with content, ie. you have labeledgroup control, and inside have columns layout with 2 textboxes, can this somehow be achieved to stay in line? maybe im doing something wrong.. 

    Kivito

    Wednesday, October 05, 2011 7:53 AM
  • Hi Kivito,

    Do you mean that the lable isn't lined up, or that the two textboxes aren't lined up? If it's the textboxes, then I know about this bug. I mentioned it in the description. It doesn't always happen, but I've not yet worked out why it does. I think it's a padding issue, but I'm not sure. As soon as I can fix it, I will upload a new revision.

    If it was the label itself you meant, then I've never seen this happen. Please can you attach a screen shot here, so I can see it.

    Thanks for the kind feedback.


    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/
    Wednesday, October 05, 2011 1:10 PM
  • Mr Yossu,  do you have any plan to add support for borders & shadows for your label controls?  Or am I miss something here?
    -Bala
    Wednesday, October 05, 2011 1:13 PM
  • Well, it turned out to be easier than I thought! I fixed the bug, and have uploaded a new version, so please download it and see if it fixes your problem. If not, then please post back with a screen shot.

    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/
    Wednesday, October 05, 2011 1:31 PM
  • Hmm, I hadn't thought of it, but I could do it without too much trouble. I'll add it to my list of things to do and see how much time I have. I have some other controls I want to include, so I'll have to decide which is more important!

    Thanks very much for the suggestion.


    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/
    Wednesday, October 05, 2011 1:38 PM
  • haha, just when ive managed to take screenshots.. nevertheless, here are screenshots from previous version:

    i'll try with new version..

    Kivito

    Wednesday, October 05, 2011 1:40 PM
  • Hi Kivito,

    I see what you're doing, and it wasn't the bug I had addressed. I thought you were talking about the horizontal alignment, which was slightly out, but has now been fixed.

    To be honest, I hadn't thought of using the control the way you showed, as my main interest was a case when you wouldn't be showing the labels of the individual controls (like the postcode example I used in the description), so I didn't notice that issue.

    I tend to collapse the textbox labels, and use the labelled group's label to display the info to the user, like you can see in the screen shot in the overview at the top of the gallery page.

    Unfortunately, the vertical alignment of the label isn't in my control (as far as I can see at the moment), so I'm not sure if I can fix this. I'll have to see if I can find any information on it.

    Thanks for pointing that one out.


    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/
    Wednesday, October 05, 2011 1:57 PM
  • sure! no problem, glad that i can help in anyway..

    just one question about stylable label control: can we change colors and font size @ runtime?

    Kivito

    Wednesday, October 05, 2011 2:10 PM
  • Yes you can. I meant to include that in the description, but forgot!

    You can use FindControl to get hold of the underlying TextBlock, and then set any properties you like.

    If you look at the screen shot in the overview for the stylable static label (4th image on the page), you'll see a simple mock-up of a screen I have in an application for a business directory. The screen allows the owner to set up a listing in a directory category for the business. As he changes the listing type combo, the message under the description box changes (this one is actually done with the non-static version), and depending on the contents of the textbox, the font colour also changes as a warning.

    Hope this helps. If you need any more help getting this working, let me know and I'll post some code.


    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/
    Wednesday, October 05, 2011 2:18 PM
  • thanks! gonna play with that!

    cheers!

    Kivito

    Wednesday, October 05, 2011 2:28 PM
  • Wow, 100 downloads! Thanks to everyone who tried it, and for all the great feedback.

    I hope to have a new version out later today with some extra features.


    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/
    Thursday, October 06, 2011 2:26 PM
  • Hi again Bala,

    I've just uploaded version 1.3 of the controls, and support for border and drop shadow on the two stylable labels is now included.

    Thanks again for your feedback!


    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/
    Thursday, October 06, 2011 3:19 PM
  • Hi,

     

    Amazing control......Thanks...

     

    I have a question.

     

    Is there a way to do the same thing with ordinary textboxes or is it impossible?

     

    It would be nice to change the size or color not only to static or readonly textboxes.

     

    Just a thought, but again, THANKS for a great exstension...

     

    //Sven


    SE1969
    Thursday, October 06, 2011 4:20 PM
  • Hi Sven

    It would be possible to create a stylable textbox, which would allow you to set the font size, colour, etc. I might add that to my list of ideas.

    You can do it with ordinary textboxes, but you would have to write some code to find the textbox and set the properties. A control would allow you to do it all in the screen designer. Sounds like a good idea.

    Thanks again.


    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/
    Thursday, October 06, 2011 4:27 PM
  • Yes it would be nice......

     

    Maby conditionnel too....

     

    I have a grid where I would like to color readonly rows so it would be possible for users see which rows are not editble...

    //Sven


    SE1969
    Thursday, October 06, 2011 4:34 PM
  • Hmm, the stylable textbox shouldn't bee too hard. In fact I'm already on it, but the grid might take longer. I'll have a look when I've done the easy ones, but as I'm off for ten days from the middle of next week, and I have loads of real work to do before then (I do these controls for fun and to help out, I don't get paid for them unfortunately), it might not happen that quickly. Could be that if one of the experts is reading this thread, they may jump in and create a grid like you asked.

    How about it Yann?


    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/
    Thursday, October 06, 2011 4:44 PM
  • I wish I could pay you for your work! accountnumber???? ;)

     

    I'm going to have it a go myself and see what a swede is made of...  :)

     

    Bye for now!

    //Sven of Sweden!


    SE1969
    Thursday, October 06, 2011 5:53 PM
  • I wish I could pay you for your work! accountnumber???? ;)

    Hee hee, I'm getting all the payback I need from these comments. Maybe I'm just a kid at heart, but I get a big kick out of producing something that people like.

    I'm going to have it a go myself and see what a swede is made of...  :)

    Great idea! Let us know how you get on. Thanks again for the feedback.


    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/
    Thursday, October 06, 2011 6:10 PM
  • Is there a way to do the same thing with ordinary textboxes or is it impossible?

    Sven,

    Please download the latest version of the controls, as that includes a stylable textbox (as well as three other new controls, and some improvements to the existing ones). The textbox doesn't let you set the foreground colour, as I had some problems with that, but it does allow you to set the background, the border, bold and italic.


    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/
    Thursday, October 06, 2011 8:29 PM
  • My goodness, that was fast. I'm going to try it out today after work....Got to own some money first.... :)

     

    THANKS!!!!!

     

    //Sven


    SE1969
    Friday, October 07, 2011 6:42 AM
  • Thanks Alan, great enhancements, this will cut down on some coding ....... hang on a minute ..... I'll soon be out of a job ;)

    Any chance we could have the Image control map to a method, i.e. when clicked ?

    Keep it up.

     

    D


    There's no right way ... but there may be a better way
    Friday, October 07, 2011 1:57 PM
  • Hi again Bala,

    I've just uploaded version 1.3 of the controls, and support for border and drop shadow on the two stylable labels is now included.

    Thanks again for your feedback!


    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/

    You the man. :)

     

    I missed this yesterday. :(


    -Bala
    Friday, October 07, 2011 4:05 PM
  • Any chance we could have the Image control map to a method, i.e. when clicked ?

    Hmm, that's an interesting idea, although it's not something I woudl know how to do right now. Sounds like I need to read up a bit more about commands, which is a part of the extensibility I haven't had time to study yet. Maybe you've given me the incentive!

    Got a couple of other controls I want to include, plus some improvements to the existing ones, and I'm off work for ten days from the middle of this week, so might not get chance to look at this one for a while, but I'll make a note of it for when I come back.

    Thanks


    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/
    Sunday, October 09, 2011 2:58 PM
  • OK, just to keep you updated, I fixed the alignment bug, so the label on the labelled group is now correctly aligned. Please download version 1.5 (or later) to get this bug fix.

    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/
    Sunday, October 09, 2011 3:32 PM
  • I also have a suggestion which I posted in gallery.   Could you make the border properties as dimensional like Yann's controls do?
    -Bala
    Sunday, October 09, 2011 5:52 PM
  • Sure, no problem. Never occurred to me that people would want such fine control as to use non-integers (I assume you mean values like 1.5), but it's easy enough to do.

    I'm hoping to get a new release out either this evening, or tomorrow (depending on how time goes) with a new control, so I'll try and include this change in that release. If not, it should be done soon after.

    Thanks for the suggestion.


    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/
    Sunday, October 09, 2011 6:03 PM
  • Alan,

    Just wanna be make sure we are in the same page, right now if I give 'static label's border property as  "1,2,3,4", it throws an exception and thats why I thought your control's border property supports only integer.  Yann's TextBlock does support dimension border, but control requires either entity property or one screen property per heading or so.

     

    Where your static label does that amazing job (but only accepts integer but not dimension type), I hope I can replace TextBlock in favor of your static label.  Best of both worlds. :) :) 


    -Bala
    Sunday, October 09, 2011 6:16 PM
  • Right, now I'm with you!

    My controls currently only support one number for the border, and that number is used all the way round. So, if you give 2 as the value, the border thickness will be 2 on all sides.

    Yann's control allows you to set the border for each side individually, by making use of the "1,2,3,4" convention. I thought I would keep things simple by just allowing a single number.

    However, I could still do it the way you want, and allow a single number, giving the best of both worlds. You could enter either, and if it was a single integer, it would be used for all four sides.

    Was that what you meant? If so, please let me know and I'll add that. Not a huge change, and if it will make the controls better, then it's worth doing!

    Thanks


    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/
    Sunday, October 09, 2011 6:42 PM
  • Exactly!!! :)

     

    Thats all I need.  Also if possible, please allow us to enter negative values & decimals (if they are appropriate for a particular control) 


    -Bala
    Sunday, October 09, 2011 6:54 PM
  • Thought it would be nicer to add these properties too (I never quit asking... :) :)).

     

     

     


    -Bala
    Sunday, October 09, 2011 7:01 PM
  • OK, changing the existing border setting so that it takes 1,2,3,4 shouldn't be a problem, and I can allow decimal values (ie 1.5) without problem, but I'm not sure why you would want to enter negative values for a border. Can you explain that one?

    Edit: Ah, just noticed your next post, in which you have negative values for the padding. That makes more sense.


    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/
    • Edited by Mr Yossu Sunday, October 09, 2011 8:06 PM
    Sunday, October 09, 2011 8:00 PM
  • Hee hee, this is starting to look like I'm duplicating Yann's control. Still, they say that imitation is the sincerest form of flattery!

    However, I doubt I'll get chance to add all that before my break, so these will have to wait a couple of weeks. I'm hoping to change the existing border tomorrow though.

    Thanks again. Feel free to keep asking. I'm not promising I'll implement every suggestion, but keep them coming anyway!


    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/
    Sunday, October 09, 2011 8:01 PM
  • Take ur time Alan. Not in any rush. And thx again for your contribution.
    -Bala
    Sunday, October 09, 2011 8:46 PM
  • Just uploaded version 1.6, which includes a new Web Link control, and adds multiline support to the Stylable TextBox.
    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/
    Monday, October 10, 2011 2:24 PM
  • Thank you, Mr Yossu, for this great controls.

    I tried to use your StylableTextBox but it seems like changing the background color is not working when the control is linked to a navigation property. Here's a screen snapsot for my screen:

    Among two StylableTextBox inerted, [HoleSizeColor] worked but [BackColor] didn't. The difference is that [HoleSizeColor] is bound to a normal field but [BackColor] is bound to a navigation property, for which LS assigns controls for group property such as Rows Layout, etc. As shown in the screen shot, the dropdownlist even does not show Pixata StylableTextBox in this case. I had to assign a CustomControl first and then change it to StylableTextBox in Properties window.

    It might be the way I set the color in code behind. This is my code:

                If IsHoleSizeColorTextBoxAvaialble Then
                    cip = Me.FindControl("HoleSizeColorTextBox")
                    cip.SetBinding(PixataCustomControls.Presentation.Controls.StylableTextBox.BackgroundProperty, "Value", New ColorConverter(HoleSizeColor), BindingMode.OneWay)
                End If
    
                If IsBackColorTextBoxAvailable Then
                    cip = Me.FindControl("BackColorTextBox")
                    cip.SetBinding(PixataCustomControls.Presentation.Controls.StylableTextBox.BackgroundProperty, "Value", New ColorConverter(BackColor), BindingMode.OneWay)
                End If
    
    
    Public Class ColorConverter
        Implements IValueConverter
    
        Private Property TargetColor As Windows.Media.Color = Windows.Media.Colors.White
    
        Public Sub New(color As Windows.Media.Color)
            TargetColor = color
        End Sub
    
        Public Function Convert(value As Object, targetType As System.Type, parameter As Object, _
            culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
    
            Dim ColorBrush As New SolidColorBrush(TargetColor)
            Return ColorBrush
        End Function
    
        Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, _
            culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
            Throw New NotImplementedException()
        End Function
    End Class
    

    I don't have a firm understanding how to use ColorConverter but just copied from some post and modified a little bit. You didn't put a sample code how to use it in your Control publish. Could you also teach me how I can change the background color(or any other properties)  of StylableTextBox in code behind file?

    Thank you very much in advance.

    Best regards,

    RiverWay


    • Edited by RiverWay Monday, October 10, 2011 6:04 PM
    Monday, October 10, 2011 5:57 PM
  • Hi RiverWay,

    I'm a bit confused as to what you're doing here. You say that BackColor is bound to a navigation property, which sounds to me like it's a related entity. If so, why are you using a textbox (of any sort) for it? Surely a related entity would be edited in its own screen.

    The reasn the dropdown doesn't show my control, is that it (like the normal textbox as far as I know) is designed to work with data types that can be directly converted to and from a string. If BackColor is a navigation property (ie an entity), then there isn't a direct conversion to and from a string, so Lightswitch won't offer the control.

    Can you use a normal textbox for this? I would be surprised if you can, but I would like you to confirm this, because if you can, then I need to understand more exactly what you're doing.

    The other issue is that I never intended the background colour to be bound to a data value elsewhere on the screen. I'm not saying you can't do this, but I didn't have this in mind, so can't say for sure that it should work. In theory it should, but not having tried it, I can't be sure.

    Please can you clarify what you're trying to do here, and especially exactly what the BackColor is, a plain data field or a related entity.

    Thanks


    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/
    Tuesday, October 11, 2011 9:35 AM
  • Thank you Mr. Yossu.

    [BackColor] is a foreign key (navigation property in EDM) field. So LS automatically suggests group controls as shown in the screen shot. I could't choose TextBox for it. This is a readonly screen and user does not need to edit the property. That was the reason why I wanted to use a textbox.

    What made me wondering was LS designer allowed me to choose 'Custom Control' and choose pixata StylableTextBox fromm property window. And then when I tried to set binding the property value from code behind, it didn't work. 

    Wednesday, October 12, 2011 3:08 PM
  • Don't worry too much for this issue, Mr. Yossu.

    It might be because I set the parent control of [BackColor] StylableTextBox as a readonly. Since I deleted this part alreday from my project (the user said the requirment is not necessary any more) I can't test this assumption now. The application contains my own ColorTextBox custom control (very simple one with a Silverlight textbox) too and it showed a similar behavior.

    Thank you anyway. I am really grateful since I actively use your controls in my LS project.

    Thursday, October 13, 2011 1:00 AM
  • Hello,

    Thanks for the follow-up. I think the problem was partly because navigation properties woudln't normally be displayed in a textbox, as that could lose the foreign key relationship. Not sure why LS allowed you to use my control there anyway!

    If I get time, I'll have a look, but as it's no longer a problem for you, I won't put a high priority on it unless someone else reports it!


    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/

    Sunday, October 23, 2011 3:21 PM