Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi I have a problem with implementing this in C# WPF:

C#
if(condition1)
   <myusercontrol:usercontroltabpagecontent1 />
else if(condition2)
   <myusercontrol:usercontroltabpagecontent2 />
else  
   <myusercontrol:usercontroltabpagecontent3 />
Posted
Updated 7-Sep-11 0:41am
v2

You cannot define if conditions in a xaml.
However, you can use a converter as a workaround - see here[^].
 
Share this answer
 
If it were me, I would create the tab pages in xaml, but set them initially to be hidden (or collapsed). And then, in the code behind (or via triggers in the control template for the tab control), I would show/hide the pages as appropriate.
 
Share this answer
 
In addition to what JSOP said, examine the user controls very well and identify items/control that are similar. You can even create just one user control and dynamically change the content at run-time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900