SXA : Extreme Custom Search

SXA is all about accelerating the development by providing loads of features and component OOTB. In the past few years, I have been using search components a lot. E.g. property listing, product listing and many more.

Search component works with the Search Scope where user can provide the search query and limit the result. The search query can be extended by using SXA search tokens.

Nice article by Gert Gullentops :


I have been working on a real-estate website that required immense search functionality. It involved numerous business logic to search the properties based on given filters. Sitecore search query interface generates linear query E.g.

q=(((_path:(3936107d3534414c860878b3fdf61c76) AND _language:(en)) AND _latestversion:(True)) AND _templatename:(Page))&start=0&rows=1000000&fl=*,score&fq=_indexname:(sitecore_master_index)&facet=true&facet.field=active_b&f.active_b.facet.mincount=0&wt=xml

Currently, there is no way where user can generate deeply nested queries, to my knowledge, if you please know to write in the comment. E.g.

(condition 1) 
	(Condition 2 OR Condition3 OR Condition4)
	(Condition5 OR Condition 6 OR Condition7)
	(Condition 8 AND Condition9 AND Condition10)
	(Condition11 AND Condition 12 AND Condition13)

Current Implementation

Search Result component consumes Sitecore.XA.Foundation.Search.Services.SearchService.SearchService to post a query and get the processed output. Let understand one of its important method GetQuery below.


Sitecore and SXA are all about extension and we need some way to inject our queries. I wanted to do less customization as much as possible, thus during the next upgrade, it should not be a big issue. The idea is to inject our pipeline or piece of code which calls external code from the feature or Projects, which add extra predicates.

The solution is implemented in two parts:

First, extend the foundation of the Search Service. (I will use for loop for the demo purpose, suggested approach is the pipeline)

Extended Search Service

//Inherit Search Service and override constructor and GetQuery method.
public class ExtendedSearchService : SearchService
    private IEnumerable<ISearchFilter> Filters;

    public ExtendedSearchService () : base()
        //Get all filters registered by the developers, from DI
        Filters = ServiceLocator.ServiceProvider.GetServices<ISearchFilter>();
    //Override the implementation.
    public overide virtual IQueryable<ContentPage> GetQuery(SearchQueryModel searchQueryModel, out string indexName)
        Item contextItem = GetContextItem(searchQueryModel.ItemID);
        ISearchIndex searchIndex = IndexResolver.ResolveIndex(contextItem);
        IList<Item> list = searchQueryModel.ScopesIDs.Select(Context.Database.GetItem).ToList();
        indexName = searchIndex.Name;
        IEnumerable<SearchStringModel> models = list.Select((Item i) => i["ScopeQuery"]).SelectMany(SearchStringModel.ParseDatasourceString);
        models = ResolveSearchQueryTokens(contextItem, models);
        IQueryable<ContentPage> source = LinqHelper.CreateQuery<ContentPage>(searchIndex.CreateSearchContext(), models);
        string text = NormalizeSearchPhrase(searchQueryModel.Query);
        source = source.Where(IsGeolocationRequest ? GeolocationPredicate(searchQueryModel.Site) : PageOrMediaPredicate(searchQueryModel.Site));
        source = source.Where(ContentPredicate(text));
        source = source.Where(LanguagePredicate(searchQueryModel.Languages));
        source = source.Where(LatestVersionPredicate());

        /*custom code starts*/
        //Custom argument type.
        FilterArgs args = new FilterArgs()
            Source = source,
            QueryString = WebUtil.ParseUrlParameters(HttpContext.Current.Request.RawUrl) ,
            SearchQueryModel = searchQueryModel,
            ContextItem = contextItem,
            ScopeItemlist = list
        //Extension for external Filters, which can add more complex predicates.
        // below code can be replaced with pipeline implementation.
        // Open for change, close for modification
        foreach (var filter in Filters)
            if (filter.CanApply(args))
        source = args.Source;
        /*custom code ends*/

        source = source.ApplyFacetFilters(Context.Request.QueryString, searchQueryModel.Coordinates, searchQueryModel.Site);
        return BoostingService.BoostQuery(list, text, contextItem, source);

Argument Class:

public class FilterArgs
        public IQueryable<ContentPage> Source { get; set; }
        public Item ContextItem { get; set; }
        public NameValueCollection QueryString { get; set; }
        public IList<Item> ScopeItemlist { get; set; }
        public SearchQueryModel SearchQueryModel { get; set; }

Search Filter Interface

public interface ISearchFilter
        bool CanApply(FilterArgs args); //if current scope id or name matches then apply method will be called.

        void Apply(FilterArgs args); //Add complex predicate to the existing source.

Register the new extended search service.

<?xml version="1.0"?>

<configuration xmlns:patch="" 
      <configurator type= "SxaExtension.Foundation.Search.DI.ServicesConfigurator, SxaExtension.Foundation.Search"/>
      <register serviceType="Sitecore.XA.Foundation.Search.Services.ISearchService, Sitecore.XA.Foundation.Search" set:implementationType="SxaExtension.Foundation.Search.Services.ExtendedSearchService, SxaExtension.Foundation.Search" lifetime="Singleton"/>

Now lets implement the feature or project part, where we can implement ISearchFilter interface and register our filter in DI.

Sample and simple use case(for better understanding) , when user search for property in the given suburb , but also wants to find the properties from the surrounding suburbs. Additionally property should be active and surrounding suburbs must be within 20 Kilometres radius from the given suburb.

Sample Filter

namespace SxaExtension.Feature.Property.SearchFilters
    public class PropertySearchFilters : ISearchFilter
        private readonly ID PropertySearchScopeId = new ID("ID of your scope");
        private readonly ISuburbService SuburbService;

        public PropertySearchFilters()
            SuburbService = ServiceLocator.ServiceProvider.GetService<ISuburbService>();
        //Decides, should apply filter or not, based on scope id and query value.
        //This can be have custom conditions based on your business logic.
        public bool CanApply(FilterArgs args)
            string queryValue = GetQSParam("q");
            if (args.SearchQueryModel.ScopesIDs.Contains(PropertySearchScopeId) && !string.IsNullOrWhiteSpace(queryValue))
                return true;
            return false;

        public void Apply(FilterArgs args)
            List<string> suburbs = new List<string>();
            string query = GetQSParam("q");
            //Find requested suburb
            var suburb = SuburbService.GetSuburbs(args.ContextItem, query, false)?.FirstOrDefault();
            //Find surronding suburbs of given suburb
            suburbs = SuburbService.GetSurroundingSuburbs(args.ContextItem, query, false);
            //Builds OR predicate.
            var predicate = PredicateBuilder.False<ContentPage>();
            foreach (var s in suburbs)
                //p[(ObjectIndexerKey)"surroundsuburbIds"] is the way to access properties not listed on content page model.
                predicate = predicate.Or(p => p[(ObjectIndexerKey)"surroundsuburbIds"].MatchWildcard($"\"{"|" + s + "|"}\""));
            args.Source = args.Source.Where(predicate);
            args.Source = args.Source.Where((p => ((string)p[(ObjectIndexerKey)"status"]) == "Active"));
            args.SearchQueryModel.Coordinates = suburb.Location;
            if (args.SearchQueryModel.Coordinates != null)
                //Check for radius.
                args.Source = args.Source
                    .WithinRadius(s => s.Location, args.SearchQueryModel.Coordinates, 200000,true)
                    .OrderByDistance(d => d.Location, suburb.Location);

        private static string GetQSParam(string param)
            var qsParams = WebUtil.ParseUrlParameters(HttpContext.Current.Request.RawUrl);
            var queryValue = qsParams[param];
            return queryValue;

Service Configurator

namespace SxaExtension.Feature.Property.DI
	public class ServicesConfigurator : IServicesConfigurator
        public void Configure(IServiceCollection serviceCollection)
            serviceCollection.AddTransient<IPropertyRepository, PropertyRepository>();

		private void RegisterSearchFilters(IServiceCollection serviceCollection)
			serviceCollection.AddSingleton<ISearchFilter, PropertySearchFilters>();


Register Configuration

<?xml version="1.0"?>
<configuration xmlns:patch="">
			<configurator type= "SxaExtension.Feature.Property.DI.ServicesConfigurator, SxaExtension.Feature.Property"/>

I hope this post helps you to understand the purpose and essence of the customization.

Sitecore: AuthorizationManager check failed..

Recently I was installing Sitecore 9.3 XP on client’s machine using SIA (Sitecore Install Assistant). During the process I got below error.


The following error occurred while loading the extended type data file:
Microsoft.PowerShell, C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\SitecoreInstallFramework.types.ps1xml: The file was skipped because of the following validation exception: AuthorizationManager check failed..

                       Sitecore Install Framework
                             Version - 2.1.0

WorkingDirectory : C:\SC\Sitecore 9.3.0 rev. 003498 (Setup XP0 Developer Workstation rev. 1.1.1-r4)
WhatIf : False
Verbose : SilentlyContinue
Configuration : C:\SC\Sitecore 9.3.0 rev. 003498 (Setup XP0 Developer Workstation rev.
Debug : SilentlyContinue
AutoRegisterExtensions : False
WarningAction : Continue
ErrorAction : Stop
InformationAction : Continue


In some client’s machine have more security setup which blocks the execution of PowerShell scripts. The solution is to unblock the script file.

Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules\' -Recurse | Unblock-File

The above code will unblock or removes the security restriction from the powershell script and you will not get the error again.

SXA: Dynamic Browser Title

Hi Folks,

I would like to share my learning and findings with you. Recently one of my project required to implementation SEO changes like dynamic browser title which should display value of page field into browser title of the page.

The project was setup by another developer, so never bother to look for an implementation.

After digging the component for the implementation, I discovered that Source of Browser title is actually a “Variant”…! 🙂

By default it refers the Title field of Browser Variant under Settings.

However, in our case we implemented another field called Product Title of type “Template”, because we want “Product Title” field to apply the only specific template. Template field allows us to refer content item’s field value as show in below screen.

Browser Title 1

We also add another rule to default title field to exclude the product template, thus only one title gets applied.

I hope you like it and find useful in your project.

SXA: Personalized Rendering Variants


I see the rendering variant as a separate component compare to traditional Sitecore renderings. Currently, Sitecore supports personalization on Renderings directly but not Rendering Variants. You can still achieve the personalization within the rendering variant by applying rule which is not user-friendly, but not between the variants.


This solution will allow a content author to personalize the rendering with the available variants through the personalization dialogue screen.

If a variant personalization has been setup by the content author, then whenever personalization rule matches it will apply the rendering variant setting to the given component at runtime.

Some use cases

  • Display partial view if a user is not logged in, once a user logged in successful show comprehensive view of the content.
  • Present content with a different look and feel when user SSO (Single Sign On) in to your website based on the client.
  • Display different view when a user visits from the different geographical location.
  • Any situation where you want to switch between the rendering variants based on some condition.


  • Install the package.
  • In case of different .Net version, manually compile the code according to you .Net version and deploy the dlls into the bin folder.
  • In case of different Sitecore version, you many have to change the processor.


Assuming you have followed the installation process.

  1. Select any SXA component which supports the rendering variant(Presentation->Details->Layout Details)
  2. Click Personalize button
  3. You will find the Variant Drop-down listing all variants for the respective components.
  4. Add personalization rule
  5. Select the rendering variant for the rendering.


This solution has implemented below items:

  1. Overriding the default personalize box with the custom personalize dialog box, which shows the variant drop-down list.undefined
  2. New action to apply rendering variant parameter to the given rendering.undefined
  3. Few processors to pass the applied personalized variant parameter between the processors. undefined

Existing Issue

Experience Editor: A user cannot see the variant applied when they change the personalization from the drop-down list during the edit mode.



Thanks for reading and liking. Feel free to extend the module or contact me in case of an issue at

Note: I have not thoroughly tested this module.

Sitecore TDS to Unicorn

Migration: TDS to Unicorn in Sitecore

Sitecore TDS to Unicorn

Hi Friends, recently I received an inherited project of the Sitecore which was using TDS (Team development System). I like that product however due to cost saving and developer preference we had to convert that all TDS project into Unicorn based config.

There were approx 60 projects and we had two approaches:

  1. Manual creation of unicorn config file which contains the predicates
  2. Script to convert and create unicorn config file.

We choose the option 2 started. I started analyzing the TDS Project’s file and its XML structure. The good thing about the project was they were name based on helix pattern.

It had many situations like:

  1. Include Tree
  2. Include Item without child.
  3. Include Item with the selected child.
  4. Exclude the item
  5. And many more…..

I ended up with the below script which generates the single Unicorn config file containing all predicates following helix pattern. I also created the base config file which you can use in you project to remove the base predicates from the generated file.

Git Repository :

I hope this utility will save your time and effort. Feel free to change the script according to you needs.

Happy Sharing…

Export Sitecore Item as Package

Hi Sitecore Enthusiast,

Today I just made another small module for Sitecore content editor from where user can export sitecore item and its children as package directly without going to Package Designer.

Off course this is not package designer replacement, but it is developed by keeping in mind that mostly content editor or developers needs to move small content from one environment to another very frequently e.g. dev to staging OR staging to live.

Export sitecore item as package

Export Sitecore Item as Package

Installation Steps:

1. Download Sitecore module from marketplace or Github.

2. Install using sitecore install package wizard.

3. Restart client.

4. Enjoy module.


Thanks for reading and using module.



Sitecore + SOLR

First experience with Sitecore 8 using SOLR ?

Hi Sitecore Enthusiast,

Today I want to share my first experience with Sitecore 8 using SOLR. I’m fan of Lucene and have implemented complex search architecture so far. However I wanted to play with SOLR as I heard about its benefits like e.g. if loads of content then SOLR is better , if you access index over HTTPS then SOLR and bla bla bla but not clearly documented anywhere.

Recently Sitecore posted very useful articles which will helps you in clear your queries and helps you to decide weather you should use Lucene or SOLR base on your requirement.

When and Why ?

  1. Using Solr or Lucene
  2. The role of Solr and search in the xDB

After reading above articles I got clear picture of both tools and its capabilities, then I read many blogs on implementing SOLR locally and found almost everyone has different experience and challanges of installation and implementation as SOLR and Sitecore 7.x and 8.X has changed their config and API as part of evolution and improvement.

How to ?

I followed below blogs to setup SOLR(5.2.1) locally with my existing Sitecore 8 (update 3) successfully.


Good for understanding as they target 7.X and older SOLR version.

Below one I used and succeed.


I follow below link to implement SwitchOnRebuildSolrSearchIndex so that my environment will not get downtime while index rebuilding.


I face below errors while implementing SwitchOnRebuildSolrSearchIndex .


Could not resolve type name: Sitecore.ContentSearch.SolrProvider.Swi
tchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrSearchProvid
er (method: Sitecore.Configuration.Factory.CreateType(XmlNode config
Node, String[] parameters, Boolean assert)).


Replace below line.

<index id="sitecore_analytics_index"
type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrSearchProvider">


<index id="sitecore_analytics_index"
type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider">


Could not create instance of type: Sitecore.ContentSearch.SolrProvid
er.SwitchOnRebuildSolrSearchIndex.No matching constructor was found.


Comment out below line, as class SwitchOnRebuildSolrSearchIndex only take 4 parameters.

<!--<param desc="group">experience</param>-->

Thanks for reading, I hope post has help you to understand and setup your environment.

My experience was good as many people has posted their hard work. I keep sharing my update on SOLR and Sitecore.


Minimum On-Premise Sitecore 8 Setup

Hi Sitecore Enthusiast,

Sitecore 8 is getting popular day by day due to its new power and capabilities, also customers are showing willingness to create/migrate their website on this powerful platform.

With this new solution, it also brings different infrastructure requirement which really makes it powerful. Being a Sitecore lover and Solution Architect I keep reading lots of blogs and articles to brush up my skills and knowledge. I was amazed by knowing Sitecore 8 scalability options available like On-Premise, Hybrid and xDB Cloud.

One day my Project Manager Sam, asked me to propose infrastructure requirement for our new client and our conversation begins:

Sam: Hey Mrunal we have new client and have to propose infrastructure requirement.
Me: That’s great… ! Which version they want to implement?
Sam: Sitecore 8…..!
Me: Hurry we have first client on 8 🙂 No worries I will give you by EOD. (But in my mind I was not confident about it as we never implemented locally or on production practically, it was all theoretical til now)

While gathering information from xDB configuration document, I figured out for best result and scalability point of view you need roughly below setup:

#5 – Sitecore Instances

  1. Content Delivery Server
  2. Content Management Server
  3. Processing Server(Optional)
  4. Aggregation Server(Optional)
  5. Reporting Server(Optional)

#3 – SQL Server Instances

  1. SQL Server (Core, Master)
  2. SQL Server (Core, Web)
  3. SQL Server (Reporting)

#1 – MongoDB server instances

  1. MongoDB Session Server (Optional) can be SQL instance or In proc(not recommended for production).

When replication implemented, also below Servers not required if you select xDB option i.e. hosting this database in sitecore xDB environment

#3 – MongoDB server instances,when replication set implemented

  1. MongoDB Server (Primary)
  2. MongoDB Server (Secondary – Optional)
  3. Windows Server (Arbiter – Optional)

Above servers not required if you select xDB option i.e. hosting this database in sitecore xDB environment

Hardware Requirements

Sitecore 8 hardware requirements

Hardware requirements

Software Requirement:

For each xDB server instance that you install you need the following minimum software prerequisites:

  • Microsoft .NET Framework 4.5.
  • Windows Server 2012 R2 – recommended for most Sitecore instances, especially processing/aggregation servers.
  • MongoDB 2.6.1 or later for the collection database, session storage and tracking databases. Install MongoDB on Microsoft Windows Server as a Windows service.
  • Microsoft SQL Server 2008 R2 SP1 or higher for the reporting database.


According to John West:

For a Mongo server in the content delivery environment, Sitecore would generally recommend at least:

  • Quad-core processor(s)
  • Minimum 16GB RAM
  • 500GB of storage spread over at least two solid-state drives
  • Only use SSDs
  • As much RAM as the environment can use for maximally effective indexing
  • If the active working set reaches 60% of RAM, add shards and/or RAM
  • Never use remote file shares
  • Use 64-bit
  • Avoid NUMA disk allocation strategies
  • If you use Mongo for session, use a separate Mongo instance than that used for xDB

Ref :

The above setup/requirement totally makes sense as its purpose is to scale(horizontally and vertically) and distribute processing power between different servers to achieve the best result for enterprise application.

Me: Hey Sam, there are multiple ways to implement and host Sitecore 8, who will take decision which approach we are using like on-premises, hybrid or xDB one?
Sam: It’s totally depends on client.
Me: Can I have their license details please?
Sam: They have 3 Sitecore licences, 1 for Staging/UAT, 1 for CM and 1 for CD.
Me: What about xDB option?
Sam: I believe it will be on-premises.
Me: What about MongoDB servers and replication set?
Sam: Try to put best minimum On-premise Sitecore 8 setup with recommendations.
Me: Great… this information will help me to design infrastructure diagram.


Minimum On-Premise Sitecore 8 Production Setup

Minimum On-Premise Sitecore 8 Production Setup – Developer Version


Minimum On-Premise Sitecore 8 Setup Simple

Minimum On-Premise Sitecore 8 Production Setup – End User Version

I believe above brain storming helps you to design your solution. Keep an eye on this space where I’m going to publish how to implement above setup practically 🙂 In two versions, one for developer and one for production.

Kindly post your suggestion or idea to make this better.

Thanks for reading.
– Mrunal

Parameterized Sitecore Scheduled Task Agent

Hi Sitecore Enthusiast,

Recently one of our project require schedule agent to generate order status report for past 1,3,5,7 days (can add more in feature).As part our solution design we (I and Sam, another developer) start discussing solution so that we both remain on same page.

Sam: We need to create four schedule agents in config file with parameter Day: 1,3,5,7 and so on.

I: But they might have more agents in future with more number of days or they might want to disable some.

Sam: We will disable them from config file

I: Ya, but it will restart IIS (which I always try to avoid if solution can be achieve other way)

Sam: Also this agent should run between given time

I: What if they ask us to change time period which is quite often

Sam: But config is only way where you can specify parameters and they get mapped to property automatically or we need to extend schedule task template by adding custom properties  and can be read out from code. However it may possible other Schedule task don’t want these fields (functionality specific)?

I: Let’s add single parameter field in task template and bind parameter to properties dynamically.

Sam: That would be cool! How?

I: Here is code and solution which we will use now on words for such requirement.

Sam: Wait wait but what about schedule job must run in given time frame and must execute once per day only ?

I: Brain has already provide solution on his blog which is really good solution and fulfills our requirement, just find code below which will include all requirement and you just have to write business logic.

Sitecore Schedule Task

using Sitecore;
using Sitecore.ContentSearch.Linq.Utilities;
using Sitecore.Diagnostics;
using Sitecore.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Client.Core.Agents
	public class ReportAgent
		public ReportAgent() { }

		#region Common Property

		public string StartTime { get; set; }
		public string EndTime { get; set; }


		#region Task Specific Property
		public string Days { get; set; }


		private DateTime startDateTime;
		private DateTime endDateTime;

		public void Run(Sitecore.Data.Items.Item[] items, Sitecore.Tasks.CommandItem command, Sitecore.Tasks.ScheduleItem schedule)

				if (schedule != null)
					string parameters = schedule["parameters"];
					if (!String.IsNullOrEmpty(parameters))
						Sitecore.Reflection.ReflectionUtil.SetProperties(this, parameters, false);

				startDateTime = DateTime.Now;
				endDateTime = DateTime.Now;

				if (!string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(EndTime))
					DateTime.TryParse(StartTime, out startDateTime);
					DateTime.TryParse(EndTime, out endDateTime);

					if (!IsDue(schedule))
			catch (Exception ex)
				Log.Error("ReportAgent: Error occurred", ex, this);

		private bool IsDue(ScheduleItem scheduleItem)
			return (CheckTime(DateTime.Now, startDateTime, endDateTime) && !CheckTime(scheduleItem.LastRun, startDateTime, endDateTime));

		private bool CheckTime(DateTime time, DateTime after, DateTime before)
			return ((time >= after) && (time <= before));

		public void Execute()
				//Business logic.
			catch (Exception ex)
				Log.Error("ReportAgent: Error occurred", ex, this);

Summary :

I believe both approaches has pros and cons, but if we get more flexibility by doing small change then I always prefer to do trade off.

From Sitecore:

+ Very flexible easy to manage like configure, enable/disable

+ Can specify day(s) of week in frequency

+ No IIS restart on change, just save and publish

– Parameter not supported (by default, but can be extended)

From Config:

+ Support parameter

+ Does not depend on Sitecore task agent to get executed

– Requires IIS restarts to change.

– Not able specify day(s) of week in frequency


I hope you like our conversation and might help you understand real essence of solution. If you have any feedback I would like to hear.



How do I hide the “publish subitems” option in the publish dialog.

Hi Friends,

Recently in Sitecore Forum, Joseph asked “How do I hide the “publish subitems” in the publish dialog.” I already knew solution steps but just google to find any ready made post available if any then post in reply.

I found few but not to the point so I replied with steps exactly Joseph required and he was able to achieve his task and found him encouraged. Thus thought lets put in public so other developers have benefit too.


1. Copy Publish.xml file from “sitecore\shell\Applications\Dialogs\Publish” folder to “sitecore\shell\override” folder, so that you don’t messed up original file in case if you want to revert back your changes, just delete newly copied file.

2. Find xml code for control in Publish.xml file, some thing similar to below:

Before Sitecore 7.5:

<Border ID="PublishChildrenPane"  Visible="false">
   <Checkbox ID="PublishChildren" Header="Publish Subitems"/>

From Sitecore 7.5 onwards:

<Border ID="PublishChildrenPane" >
   <Checkbox ID="PublishChildren" Header="Publish Subitems"/>
   <br />
   <Checkbox ID="PublishRelatedItems" Header="Publish Related Items"/>

3. Add Visible=”false” attribute to border control like below: e.g.

<Border ID="PublishChildrenPane" Visible="false">
   <Checkbox ID="PublishChildren" Header="Publish Subitems"/>

4. For default checked or unchecked you can add attribute IsChecked=”True” to checkbox

<Border ID="PublishChildrenPane" Visible="false">
   <Checkbox ID="PublishChildren" Header="Publish Subitems" IsChecked="True"/>

Hope you like it… 🙂