0

I need to create 3 styles for the items in a TreeView:

Style1 should show a border at the top of the item (full line, not only this item's content width)

Style2 should have no border, but a Red background (this is done already)

Style3 should show a border at the bottom of the item

The styles will be assigned in code behind according to some situation.

How do I define the borders in these styles?

Thank you!

igorjrr
  • 790
  • 1
  • 11
  • 22
  • possible duplicate of [Different DataTemplates in one TreeView?](http://stackoverflow.com/questions/7568597/different-datatemplates-in-one-treeview) – Chris W. Feb 10 '15 at 20:27
  • @ChrisW. Not at all, I need to work with the top/bottom borders. That's my question. – igorjrr Feb 10 '15 at 20:51
  • Howdy @igorjrr , what do you think provides those borders? There's an `ItemsPresenter` in the [default template](https://msdn.microsoft.com/en-us/library/ms752048%28v=vs.110%29.aspx) that displays your Item Itemplate(s) via DataTemplate(s) so by changing your Item templates and exposing places to do your requirements and toggle them accordingly, then you'll get your required result. – Chris W. Feb 10 '15 at 21:00
  • @ChrisW. Thanks, Chris. But I don't know exactly what property I should change to draw only the top or the bottom border. Any further help? – igorjrr Feb 10 '15 at 22:49
  • 1
    You would specify an ItemTemplate with for example a `Border` control in it where you could do something like `` which in example would display a green line on just the top and bottom of that Border within your template. Hope this helps :) – Chris W. Feb 10 '15 at 23:01
  • @ChrisW. So BorderThickness it is! Thank you! :) – igorjrr Feb 10 '15 at 23:19

0 Answers0