Use any Silverlight control without having to create a "custom" control
It would be great to be able to use any standard Silverlight control in LS without having to create a "custom" control wrapper around it
6 comments
-
Mike Horihan
commented
You can use a Silverlight Control such as the Telerik RadGridView...
Add a "New Custom Control..." from the Add drop down list in the screen designer
Add the following References:
Telerik.Windows.Controls
Telerik.Windows.Controls.GridView
Telerik.Windows.Controls.Input
Telerik.Windows.DataThen choose Telerik.Windows.Controls.GridView.RadGridView
Give it a name such as TelerikGridAdd the following methods to the Screen Code Behind
partial void YourItemSearchScreen_Created()
{
var grid = this.FindControl("TelerikGrid");
grid.ControlAvailable += telerikGrid_ControlAvailable;
}void telerikGrid_ControlAvailable(object sender, ControlAvailableEventArgs e)
{
var grid = e.Control as RadGridView;
// if the grid already has items, don't re-add them
if (grid.HasItems) return;grid.AutoGenerateColumns = false;
grid.IsReadOnly = true;// add a method to the double click event of a row
grid.RowActivated += telerikGrid_Activated;// Can't get this to work with Lightswitch
//grid.Style.BasedOn = new Telerik.Windows.Themes.Windows7;grid.Columns.Add(new GridViewDataColumn() { Header = "ID #", DataMemberBinding = new Binding("Id"), TextAlignment = TextAlignment.Center });
grid.Columns.Add(new GridViewDataColumn() { Header = "Name", DataMemberBinding = new Binding("Name"), TextAlignment = TextAlignment.Center });
grid.Columns.Add(new GridViewDataColumn() { Header = "Description", DataMemberBinding = new Binding("Description"), TextAlignment = TextAlignment.Center });grid.ItemsSource = this.YourListOfItems;
//this.YourListOfItems.First().ActiveDisplay}
//Grid DoubleClick Event
private void telerikGrid_Activated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
{
var item = e.Row.Item as YourItemType;
if (item != null)
this.Application.Details.Dispatcher.BeginInvoke(
() =>
{ this.Application.ShowYourItemDetail(item.Id); });}
-
Jared Howerton
commented
My top needed controls are:
- Treeview
- RichTextEditor
- Scheduler
- Album/Photobook
- Workflow Manager -
Frank Claassen
commented
The main idea behind this is to easily change over to using 3rd party controls such as those from Telerik / DevExpress wthout having to do a heap of work as mentioned previously. Compare this to how easy it is in winforms to use 3rd party controls instead of using the standard ones. It would be nice in LS if you could click the control drop down and instead of only having the List or Grid options, have an option that says "other" and then you can pick another datagrid or chart or any control which can be used for the type of data you are workig with. Make sense?
-
Andy Kung
commented
Thanks for the suggestions! If you have to pick, what would some of the top ones be?
- LightSwitch Team
-
Frank Claassen
commented
Instead of having to create custom Silverlight controls as described here: http://blogs.msdn.com/b/lightswitch/archive/2011/01/13/using-custom-controls-to-enhance-lightswitch-application-ui-part-1.aspx to use in LightSwitch, it would be great if all Silverlight controls were available to use by default.
-
Andy Kung
commented
Thank you for submitting the idea! I'm not quite sure what you mean here. Would you mind giving me an example? Thanks!
-LightSwitch Team