arklumpus / AvaloniaAccordion

An accordion-like expandable control for Avalonia
GNU General Public License v3.0
12 stars 1 forks source link

Use Templates #1

Open PieroCastillo opened 3 years ago

PieroCastillo commented 3 years ago

This control is awesome, but, what's happen if someone wants to put another styles? A very common idea for this is make templates,

the pattern is the follow:

sample

don't worry to check if the styles changes in runtime, templateApplied is executed when another styles are applied

arklumpus commented 3 years ago

Thanks for the suggestion!

I must say I'm not very familiar with templates, but I think it should already be possible to change all relevant bits of the control using Styles that specify one of the various properties (e.g. HeaderBackground or ContentBackground); the arrows can be hidden and replaced by custom things within the header itself.

Since, apart from this, the control is just a couple of containers (one for the header and one for the content), I think that allowing the structure of the control to be changed more would significantly complicate the logic behind it (and/or require new logic to be defined with each new template)... But feel free to change my mind!

shao200 commented 2 years ago

This is a good one for you, however, I suggest you refer to WPF Toolkit Layout. Accordin is a layout component, and the content should be acccordinItem.