Is there a sample which describes how to apply the default xamwebtree.xaml style to the control?
Hi,
I was wondering if you would clarify this question. Are you asking how to utilize the control template styles that appear in the Defaults folder?
These styles are provided in case you wish to override the default look of the control. You can copy this XAML into your own Resource Dictionaries, add custom functionality or design changes to them, then assign the customized template to the tree control Template property. If you would like an example how to do that, I would be happy to whip up a sample for you. Let me know if you would like that.
Thank you,
I would like to change foreground color when the webtree is disabled. Can you please provide any sample example?
Thanks in advance,
By default, if you set the IsEnabled property on the XamWebTree to false (thus disabling it), all of the child XamWebTreeItem elements foreground will be rendered using a light gray brush. If you want to override this, there are a couple of ways you can do this. First of all, to clarify, are you looking to override the default Light Gray Foreground brush of child XamWebTreeItems when the parent XamWebTree IsEnabled property is set to false?
Thanks!
yes, that's correct, please let me know how to do it.
Thanks for your help.
Hello,
Before I send you some code, I'm going to walk you through the steps how to do it yourself. If you have any problem with the instructions, I will go ahead and submit a sample project. I think this will be more valuable to all users who encounter this post.
To apply this fix, open your project with Expression Blend.
Locate the XamWebTree item in your XAML within Blend and select the item in the Objects and Timeline panel.
At the top of the designer is the bread crumb control. Click on the tree and choose Edit Additional Templates and choose the Edit a Copy command in the "Edit Generated Item Container (ItemContainerStyle) item. This is the control template applied to all XamWebTreeItems.
To implement this request, you must override the current action the XamWebTreeItem performs on items when disabled. To make this work, you will need to change a TemplateBinding. Locate the ContentControl element named Header in the Template element hierarchy (visual tree). Reset the Foreground property in the Properties panel by clicking on the yellow rectangle (advanced options menu). This will allow you to set this Brush. Set it to the brush you wish to use for when the tree is not disabled.
Open the State panel and locate and select the Disabled state.
With this selected, any changes you make in the Properties panel will only happen when the Tree Item is disabled. Change the Foreground brush to the color you want when the control is disabled.
You will notice that the disabled text will still be faint in color. While the Disabled state is still active, locate the container element named ExpansionIndicator. Set the Opacity to a different value if you don't wish for the text to appear semi-transparent.
Save and select the root element in the bread crumb control to return to the root layout.
Be aware once you introduce a control template override, you are respoinsible for how the element will be presented. This means if you upgrade to a newer version of NetAdvantgage in the future and if Infragistics changes the architectural layout of an XamWebTreeItem Template, then your override may break. This is rare. However, you should know about this. Overriding the control template also gives you the ability to customize the complete look of the tree item.
Good luck!
Thanks for the quick answer. but we don't use Expression Blend in our company, If you sample code, please send. Thanks
Speaking from the point of view of a software engineer, I find Expression Blend to be an incredible development tool. I would be so bold as to say that my expertise with this tool has boosted my productivity 100 percent. I code XAML, edit controls, produce precise layouts, and use the various editors in Blend to produce XAML much faster than I could in Visual Studio (to be fair VS2010 does improve vastly in this area). I use Visual Studio to design and produce the architectural pieces of the XAML then complete the XAML in VS, making it maintainable. From then on I split maintenance of XAML between the two tools. Both tools are indespensable for WPF and SIlverlight development.
To complete this post, I have attached a sample Silverlight 4 application which includes a working example of overriding the default control template for a XamWebTreeItem. In the template, look for the Disabled state in the VisualStateManager section of the template. This is where I am setting properties to produce the look of the tree item when the control IsEnabled property is set to false. Look for the element named Header to change the default foreground color for the element's content.
Finally, I should note there is a limitation with the VisualStateManger that limits the use of TemplateBindings. Thus this change breaks the ability to change the Foreground color outside of the control template.
Thank you!
Thanks for the help, this really helped. I also requested for Expression Blend, and tried your suggestions, works great.