I suggest you ...

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

109 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Frank ClaassenFrank Claassen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    6 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Mike HorihanMike Horihan commented  ·   ·  Flag as inappropriate

        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.Data

        Then choose Telerik.Windows.Controls.GridView.RadGridView
        Give it a name such as TelerikGrid

        Add 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 HowertonJared Howerton commented  ·   ·  Flag as inappropriate

        My top needed controls are:

        - Treeview
        - RichTextEditor
        - Scheduler
        - Album/Photobook
        - Workflow Manager

      • Frank ClaassenFrank Claassen commented  ·   ·  Flag as inappropriate

        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 KungAndy Kung commented  ·   ·  Flag as inappropriate

        Thanks for the suggestions! If you have to pick, what would some of the top ones be?

        - LightSwitch Team

      • Andy KungAndy Kung commented  ·   ·  Flag as inappropriate

        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

      Feedback and Knowledge Base