2010-05-25 80 views

回答

0

我会在网格中放置一个Border控件。然后在按钮上单击将border.Child更改为新视图。您可以在单独的UserControl xaml文件中定义每个视图。

<Grid> 
<Grid.RowDefinitions> 
<RowDefinition /> 
<RowDefinition /> 
</Grid.RowDefinitions> 
<Border x:Name="contentFrame" /> 
<Button x:Name="changeViewButton" click="click_event" Grid.Row="1" Height="22" Width="150" /> 
</Grid> 

// code behind 
protected void click_event(object s, EventArgs e) 
{ 
View1 view1 = new View1(); 
// add some code to decide which view to show, possible hold onto the view in memory etc. 

this.ContentFrame.Child = view1; 
}