How to change the data template in itemscontrol based on index?
问题 I am trying to create a dynamic UI for polynomial function. Since I do not know the order beforehand, I want to create it dynamically. I am setting my coefficient list as a items source of items control and planned to change data template based on the index. The template should work like this if (index > 1) { (coefficient text box) + *x ^ (index) + //Polynomial2 } else if (index == 1) { (coefficient text box) + *x + //Polynomial 1 } else if (index == 0) { (coefficient text box) //Polynomial }