Attachment
This control accepts an entity with 3 required, and 1 optional field:
Filename - String value to represent attachment filename
File Size - Integer value to represent attachment size in bytes
Binary Data - Binary value for storing the actual attachment itself
Icon (optional) - Image value to display for attachment on control. This is a one-way property, so it will display the image but not modify it.
To use this control, replace an entity collection (e.g. a 'SelectedItem' group you've dragged onto the screen) with the control and map the fields within the entities to the control's fields within the property editor.
From left to right, the control has:
Icon - Image specified in properties, or a default file image. Clicking this will attempt to open the file (desktop) or download file (web). Icon can be hidden.
Filename - the filename of the attached file as bound in the properties. You can optionally allow editing of the filename in the box.
Attach - Opens file dialog to request attachment. Can be disabled in properties.
Attach Mail - Opens a file dialog, defaulting to an empty Temp folder - this is intended for easy attachment of e-mails from Outlook - just drag the mail from Outlook onto the file dialog and hit OK - e-mail will be attached, and temporary .msg file will be deleted
Download - Opens save file dialog to allow downloading and saving of attachment.
Other properties supported include a whitelist/blacklist of filetypes - lists of extensions which cannot be attached (blacklist) or list of extensions that can only be attached (whitelist). Whitelist overrides blacklist if it's not empty. The blacklist details to a list of executable filetypes.
The maximum filesize in bytes can be set (defaults to 5MB).
The control accepts single files dropped onto it, and will attempt to upload these.
HTML Text
A business type and controls for storing formatted text within a string. This replaces the previous RichText type/control from earlier versions of this package.
The text is stored as HTML within a string. When adding an HTML Text property to your table in the entity designer, change the "Maximum Length" from 255 to null (i.e. remove the 255)!
There is an Editor and Viewer control for this type. Both of these are based on the RichText controls from http://www.vectorlight.net/ (so they will inherit any bugs in the vectorlight controls!)
The editor can have the buttons displayed or hidden. Note that the "Link" button does nothing at the moment, and the cut/copy/paste only work within the box just now.
The viewer simply displays the text with no editing available.
Vector Image/Button
This control allows you to specify a non-bitmapped image using an XAML/WPF Path. You specify the vector path, colour and other attributes via the Properties, rather than by loading a file in. This makes it easier to change image size, colour etc. without having to create a whole new bitmap.
This should be useful for Metro-style interfaces, and may I recommend Syncfusion's Metro Studio for a huge collection of vector images in XAML Path format!
There are a number of properties available to edit:
VectorImage: The path data e.g. for the "Home" icon above, you'd use...
F1M491.29,218.796L491.29,242.195 506.643,242.195 506.643,222.446 521.088,222.446 521.088,242.27 535.783,242.27 535.783,218.647 513.864,199.123 491.29,218.796z M535.742,204.408L535.742,191.292 528.744,191.292 528.744,198.214 513.775,184.961 513.729,184.91 481.736,213.231 486.07,218.124 513.722,193.644 541.403,218.148 545.736,213.256 535.742,204.408z (courtesy of Metro Studio)
Button: Whether icon should be displayed as a Lightswitch button (Like the "Loveheart" icon above)
Label/LabelSize: Whether a label should be displayed under the icon (as per the "Save" icon) and what size the text should be
ForegroundColour: Colour of icon in #AARRGGBB format
Background: Background style. 0=No background, 1=Circle ("Camera" icon), 2=Ring ("Save" icon), 3=Square ("Home" icon)
BackgroundColour: Colour of background shape (if specified) in #AARRGGBB format
StrokeThickness/StrokeColour: Size and colour of icon outline (as per "Home" icon) - for no outline (Metro standard), set StrokeThickness to 0
Padding: Padding between icon and background
The control exposes a "Click" event (regardless of whether image is set to be a button or not). At the moment, unless the image is a button, there is no visual indicator if it is Clicked.
An additional "Vector Image Button" control is available to replace buttons on screen, with all the same properties available (except "Button", since it's already a button)
UTC DateTime
Business type and viewer/editor for storing DateTimes in the database in UTC (GMT+0) time, and displaying/editing them in user's local time.
Editor and viewer both support long date format, and date-only, time-only or both.
NOTE: Remember, if you're dealing with the dates in code, they will be in UTC time. Use<date>.ToUniversalTime if you're putting a date into the database, and<date>.ToLocalTime if you're reading it from the database.
Radio Buttons
This control will replace a Choice List (string or integer) with Radio Buttons. A Picker and Viewer are available.
Horizontal and Vertical layout is available, as is an optional box around the buttons.
NOTE: As far as I'm aware, there is no way for a LS extension to specify that it only accepts choice lists, so this control will be available to replaceany string or integer, even if it is not a choice list.
Linked E-Mail
Editor/Viewer controls for E-mail Address business type which includes a button (to the left, or the right) to open a new e-mail to that address.
Editor and viewer both allow button to be positioned to the left or the right of the address.
The default image can be replaced by your own image, and width and height of button can be specified.
Variant Checkbox
A simple checkbox that binds to either a String, Integer, Double or Decimal rather than a Boolean.
Specify what the True and False values should equate to in the properties of the control. The control respects Nullable types, so if for example, you bind to a nullable string with True="Yes" and False="No" then if the value of the string is "Maybe" then this checkbox will show a Null value (-).
For String values, comparison will be done between Trim()'d version of the Value and the True/False Properties (but returned value will match the True/False Property exactly). This is to correctly match any padded values in an external database - e.g. a Char(3) field to store "Yes" or "No" values might end up padding the "No" to "No " to fit correctly - the checkbox will match this correctly.
ReadOnly TextBox
Sometimes you want a property that would otherwise be read/write to be displayed as read-only. You could make this just a label, but then you can't copy any text within the box. This simple control displays a value as read only, so it can still be copied, but can't be edited.
Slider
This slider control is based on SindControls SnapSlider by Roberto Sarati with a couple of simple changes. First of all, I've added "Use Property Minimum/Maximum" tickboxes - if ticked, the slider will attempt to work out the maximum/minimum value from the property itself (as defined in entity designer), rather than the value specified in the control.
Also, since LightSwitch has no sliders in it by default, any slider controls are not skinned to match whatever style your UI is, so I've made aModern UI-esque style for the slider (i.e. flat, solid colour).
The slider also has a rounding function so that if you're not using Snap to Tick then it won't give you massive invalid 9 decimal place numbers. Remember to specify at least 2 decimal places for Percent type!
Future
Visual indicator if non-button Vector Image is clicked.
Possibly allow Vector properties to be exposed and changed via code.
Extra options for Vector Image if required (may split out to separate controls to make default sizing easier for different combinations of background/label/button)
Version History
- Version 1.0:
- Version 1.1:
- Added ability to specify image for E-mail button
- Version 2.0:
- Added Vector Image and Radion Button controls
- Version 2.1:
- Fixed a reference bug that caused some projects not to build
- Version 2.2:
- Fixed radio button padding when no border used
- Version 3.0:
- Version 3.1:
- Version 3.2:
- Fixed Radio Buttons in lists so they no longer mutually-exclude selections in each row
- Version 3.3:
- Fixed bug in Attachment control for in-browser apps where files could not be attached or downloaded
- Version 4.0:
- Changed RichText type to HTML Text with new HTML Editor and Viewer controls
- Added VariantCheckbox control
- Version 4.1:
- Added VectorImageButton control for replacing buttons on screens
- Version 4.2:
- VariantCheckbox now respects ReadOnly and also compares trimmed true/false values if they are strings
- Version 4.3:
- Fixed bug in Attachment control that could cause it to think a whitelist was specified when it was not
- Version 4.4:
- DateTime UTC now handles nullable correctly (and doesn't treat nulls as 01-01-1901)
- Version 4.6:
- Fixed UTCDateTimePicker sometimes showing blank date when its bound value was changed in code behind
- Version 4.7:
- Fixed HTMLEditor control, where cursor would sometimes jump to the start of the text while you were typing
- Version 4.8:
- Another fix for HTMLEditor control to fix cursor jumping
- Version 5.0:
- HTMLEditor cursor jumping fixed
- HTMLEditor and RadioButtonPicker now respect IsReadOnly (and changes to IsReadOnly)
- Changed RadioButton style to match Modern UI/Cosmopolitan style
- Changed Attachment/LinkedEmail button icons to match Cosmopolitan style
- HTMLEditor toolbar has some issues with Cosmopolitan theme, working on a solution
- Version 5.1:
- Added ReadOnly TextBox control
- Version 5.2:
- Linked e-mail editor now respects "default domain" behaviour of original e-mail editor
- Fixed default alignment of ReadOnly Text Box
- Version 5.3:
- Version 5.4:
- Slider control now attempts to get scale/decimal places from bound property so you no longer get invalid values when not using snap to ticks
- Version 5.5:
- Added rounding options to slider
- Various other bugfixes