When the URL connection is not direct, like OtherSample, use the Group property to specify parent-child relationships.
WebPaths.cs
1 2 3 4 5 6 7 8 9101112131415161718
usingBlazorPathHelper;[BlazorPath]publicpartialclassWebPaths{[Item("TopPage")]publicconststringHome="/";[Item("Sample")]publicconststringSample="/sample";[Item("SampleC1", Group = "Sample")]publicconststringSampleC1="/sample/child1";[Item("SampleC2", Group = "Sample")]publicconststringSampleC2="/sample/child2";[Item("OtherSample", Group = Sample)]publicconststringOtherSample="/super/sub/sample";[Item("OtherSampleC1")]publicconststringOtherSampleC1="/super/sub/sample/child1";}
Specify the parent element's key in the Group property of child elements.
For another example, consider the following hierarchical structure:
To specify OtherSample as the top-level menu, set the Group property to /.
WebPaths.cs
1 2 3 4 5 6 7 8 9101112131415161718
usingBlazorPathHelper;[BlazorPath]publicpartialclassWebPaths{[Item("TopPage")]publicconststringHome="/";[Item("Sample")]publicconststringSample="/sample";[Item("SampleC1", Group = "Sample")]publicconststringSampleC1="/sample/child1";[Item("SampleC2", Group = "Sample")]publicconststringSampleC2="/sample/child2";[Item("OtherSample", Group = Home)]publicconststringOtherSample="/super/sub/sample";[Item("OtherSampleC1")]publicconststringOtherSampleC1="/super/sub/sample/child1";}
Implementing Multilingual Support (i10n) for Menu Items¶
First, create a resource file. In this example, create Localize.resx in the Resources folder with the following content: