一:HyperlinkButton点击后打开新窗口的方法
1,直接在界面中写这段代码就可以了:
<HyperlinkButton NavigateUri="http://www.cnblogs.com/wsdj-ITtech/" Content="Click Me" TargetName="_blank" FontSize="28" Height="50" Width="150"></HyperlinkButton>
2,
可以这样实现效果:
<HyperlinkButton Content="Click Me" TargetName="_blank"
Click="HyperlinkButton_Click" FontSize="28" Height="50" Width="150"></HyperlinkButton>
然后在后台写其单击事件
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
HtmlPage.Window.Eval("window.open(\"http://www.cnblogs.com/wsdj-ITtech/\")");
}
二:Silverlight中GridSplitter控件的使用
实现此效果的方法是:
1 <Grid x:Name="LayoutRoot" ShowGridLines="True" Background="White" Width="400" Height="300"> 2 <Grid.RowDefinitions> 3 <RowDefinition /> 4 </Grid.RowDefinitions> 5 <Grid.ColumnDefinitions> 6 <ColumnDefinition /> 7 <ColumnDefinition /> 8 </Grid.ColumnDefinitions> 9 <Rectangle Fill="Red" Grid.Column="0" Grid.Row="0"></Rectangle> 10 <Rectangle Fill="Aqua" Grid.Column="1" Grid.Row="0"></Rectangle> 11 <sdk:GridSplitter x:Name="grsplSplitterColumn" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Stretch" Background="Yellow" Width="6"></sdk:GridSplitter> 12 </Grid>
<Grid x:Name="LayoutRoot" ShowGridLines="True" Background="White" Width="400" Height="300"><Grid.RowDefinitions><RowDefinition /><RowDefinition /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition /></Grid.ColumnDefinitions><Rectangle Fill="Red" Grid.Row="0" ></Rectangle><Rectangle Fill="Aqua" Grid.Row="1"></Rectangle><sdk:GridSplitter x:Name="grsplSplitterRown" HorizontalAlignment="Stretch" VerticalAlignment="Top" Background="Yellow" Height="71" Margin="0,129,0,0" Grid.RowSpan="2"></sdk:GridSplitter></Grid>
Grid.ColumnSpan 属性值是用来把GridSplitter的宽度延长到其它单元格。否则其宽度仅限于它所放置的那个单元格内。
GridSplitter 另一个有用的属性是PreviewStyle,当我们设置为true时,当移动GridSplitter条时我们看到移动的是一个阴影条,当PreviewStyle属性设置为false时,GridSplitter的当前样式条将随着移动。(这句话有待考证,去试验时,感觉到不对,设置为true时,编译不通过,然后看起属性值是这样设置的)