Online sandbox has images on their custom layout controls?? - General Discussions - General Discussions - Progress Community
 General Discussions

Online sandbox has images on their custom layout controls??

  • Online sandbox has images on their custom layout controls??
  • 243833_layouts.PNG
    Why am I unable to do that yet....or can I, and it's hidden somewhere.

  • 243973_sbs.jpg
    Hello Steve,

    I am attaching a step-by-step tutorial how to add custom layout widgets in your project.

    Kind regards,
    Jordan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thank you so much for that Jordan :)

    Ok, SOOO...if my layout is created in my control assembly, and at the top I link in a ResourceLink to a CSS file which defines those images as embedded resources IN my assembly...same deal, that'll work?
  • Hello Steve,

    This will work for sure, it is pure CSS. The only problem will be if the CSS linked in your control is loaded before the Sitefinity's embeded styles. In such case just use !important.


    Kind regards,
    Jordan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Oh good, I was worried about iframe issues or something else

    I'll get on it, thanks!
  • One more quick ! if you dont mind...

    Is there some way to set that CssClass in the custom LayoutControl class?  I dont see an obvious property available (I'd just like the users to not have to enter it)
  • Hi Steve,

    You can set a CSS class for the wrapper element when you register the widget.




    All the best,
    Jordan
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hey Jordan,
      Yeah I know, I saw that in the image, the question though was can I set it in the code so the user doesn't have to do that....like I set the Layout Template Name in the SimpleView code....
  • Hello Steve,

    ResourceClassId is a configuration property. Generally you can access it from your custom control or using a custom configuration.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • So something like this in the layout?

    [ConfigurationProperty("ResourceClassId", "CssClass=Test")]

    Im not familar with config properties, says it needs to decorate a property but I dont see a CssClass property in LayoutControl
  • Hi Steve,

    You have to work with the system configurations


                var t = Config.Get<ToolboxesConfig>().Toolboxes;
                var res = t.Values.First().Tools.First().Value.ResourceClassId;

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hey Ivan,
    Ok, so this is what I ended up doing...

    public void AssignToolboxIcon(string cssClass)
                if (this.IsDesignMode() == true)
                    try
                        string type = this.GetType().ToString();
                        var toolboxes = Telerik.Sitefinity.Configuration.Config.Get<ToolboxesConfig>().Toolboxes;
                        var layouts = toolboxes.Values.FirstOrDefault(x => x.Name == "PageLayouts");
                        foreach (var config in layouts.Tools)
                            ToolboxItem tool = config.Value;
                            if (tool.ControlType == type)
                                if (String.IsNullOrEmpty(tool.CssClass))
                                    tool.CssClass = cssClass;
                                
                                break;
                            
                        
                    
                    catch (Exception ex)
                    
                
            

    Does that look about right?....seems to work, but nothing persists
  • **Edit**

    Something just occurred to me...

    Where do I put the styling for this in my assembly such that when it's installed they all showup in the backend...

    I was attaching my custom designer css in the ResourceLink control but as I was playing around I realized that style wont be coming down unless there's a control on it...