ScrollViewer 滚动条的问题

sz_free_bird 2010-12-03 05:33:28
我现在要实现的功能类似于SVN 不同版本代码比较的功能.XAML代码如下:
 <sdk:DataGrid  x:Name="dgArticles" IsReadOnly="True" AutoGeneratingColumn="dgArticles_AutoGeneratingColumn">
<sdk:DataGrid.RowDetailsTemplate>
<DataTemplate>
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderBrush="LightCyan" BorderThickness="2">
<Grid Grid.Row="0" Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="原文" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Bottom"></TextBlock>
<ScrollViewer Height="600" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Width="600" HorizontalScrollBarVisibility="Auto" x:Name="leftScroll">
<c1:C1HtmlHost x:Name="content1" SourceHtml="{Binding content}" Width="560" />
</ScrollViewer>
<Button Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" Content="通过" Width="70" Margin="2,2,10,2"></Button>
<Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Content="拒绝" Width="70" Margin="10,2,2,2"></Button>
</Grid>
</Border>
<Grid Grid.Row="0" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="重复文章 重复度:" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Bottom"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding RepeatPercent}" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Bottom"></TextBlock>
<ScrollViewer Height="600" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Width="600" HorizontalScrollBarVisibility="Auto">
<c1:C1HtmlHost x:Name="content2" SourceHtml="{Binding content}" Width="560"/>
</ScrollViewer>
</Grid>
</Grid>
</DataTemplate>
</sdk:DataGrid.RowDetailsTemplate>
</sdk:DataGrid>

我在拖动左边ScrollViewer 的滚动条时.右边的滚动条也同时滚动.
请各位大虾指点!
先谢谢了.
...全文
176 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
helloWorld1209 2010-12-03
  • 打赏
  • 举报
回复
我记得 ScrollViewer 有个sizechanged 类似这样的事件,可以在这个事件里操作下个ScrollViewer ,


但是不清楚怎么操作ScrollViewer
passself 2010-12-03
  • 打赏
  • 举报
回复
这个二者是不能相互控制的,除非你监听一个事件。当这个滚动的时候,另一个设置不能动才可以

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧