I had made a main page and use user component to implement the style of master page website. i make a drop down combo box to allow user choose their role in the combo box, may i know is that possible to call another user control with C# code beside from xaml while i need to do some logic statement.
i got one master page, loading another component with this combobox:
<ComboBox x:Name="cbRole" Height="30" Margin="8,8,8,100" VerticalAlignment="Top" ToolTipService.ToolTip="Please select your role to login" SelectionChanged="cbRole_SelectionChanged">
<ComboBoxItem Content="Admin"/>
<ComboBoxItem Content="Lecturer"/>
<ComboBoxItem Content="Student"/>
</ComboBox>
and the master page load the combo box with this line
<betata_Views_Sidebar:Sidebar/>
and i got a question on how to do this -->
private void cbRole_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int x = cbRole.SelectedIndex;
if (x == 0)
{
<betata_Views_Sidebar:Sidebar_Admin/>
}
else if (x == 1)
{
<betata_Views_Sidebar:Sidebar_Lecturer/>
}
else if (x == 2)
{
<betata_Views_Sidebar:Sidebar_Student/>
}
else
{
...
}
}
why don't you load them all and depending on the selected index, alter the visibility of the components?