ScrollViewer无法正常工作 [英] ScrollViewer not working
问题描述
我正在学习WPF。在运行时我无法在窗口右侧看到垂直滚动条。我不确定我错过了什么。有人可以帮忙吗?谢谢!
< Window x:Class =" CSE_Integrator.MainWindow"
&NBSP; &NBSP; &NBSP; xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
&NBSP; &NBSP; &NBSP; xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
&NBSP; &NBSP; &NBSP; xmlns:d =" http://schemas.microsoft.com/expression/blend/2008"
&NBSP; &NBSP; &NBSP; xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
&NBSP; &NBSP; &NBSP; xmlns:local =" clr-namespace:CSE_Integrator"
&NBSP; &NBSP; &NBSP; mc:Ignorable =" d"
&NBSP; &NBSP; &NBSP; Title =" CSE Data Integrator"高度= QUOT; 377.971"宽度=" 567.316">
$
&NBSP; < Grid Margin =" 10,10,10,10" >
&NBSP; &NBSP; &NBSP; < ScrollViewer CanContentScroll =" True"的IsEnabled = QUOT;真" VerticalScrollBarVisibility =" Visible" />
&NBSP; &NBSP; &NBSP; < Image x:Name =" imgLogo"余量= QUOT; 134,78,120,158"源= QUOT; Logo.jpg" Stretch =" Fill" />
&NBSP; &NBSP; &NBSP; < Label x:Name =" lblLogo" Content =" Company Title"的HorizontalAlignment = QUOT;左"余量= QUOT; 134,10,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 263"高度= QUOT; 32" fontWeight设置= QUOT;粗体"
FontSize =" 14" />
&NBSP; &NBSP; &NBSP; < Button x:Name =" btnEnterInfo" Content ="输入CSE数据"的HorizontalAlignment = QUOT;左"余量= QUOT; 21,225,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 107"点击=" btnEnterInfo_Click" />
&NBSP; &NBSP; &NBSP; <按钮x:名称=" btnReporting" Content =" Generate Reports"的HorizontalAlignment = QUOT;左"余量= QUOT; 283,225,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 107" />
&NBSP; &NBSP; &NBSP; < Button x:Name =" btnUpdate" Content ="修改CSE数据"的HorizontalAlignment = QUOT;左"余量= QUOT; 155,225,0,0" VerticalAlignment = QUOT;陀螺"宽度=" 107" />
&NBSP; &NBSP; &NBSP; < Button x:Name =" btnExit"含量="退出"的HorizontalAlignment = QUOT;左"余量= QUOT; 419,225,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 107"点击=" btnExit_Click" />
$
&NBSP; < / Grid>
< / Window>
谢谢
Ram
当我复制你的代码时,我可以看到ScrollViewer但是什么你认为应该怎么做。
我可以看到Xaml你是拖放控件,这在winforms中没问题,但WPF有更好的方法。
Hi,
I'm learning WPF. I'm not able to see the vertical scroll bar on the right side of my window in run time. I'm not sure what I'm missing. Can anyone help? Thanks!
<Window x:Class="CSE_Integrator.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CSE_Integrator"
mc:Ignorable="d"
Title="CSE Data Integrator" Height="377.971" Width="567.316">
<Grid Margin="10,10,10,10" >
<ScrollViewer CanContentScroll="True" IsEnabled="True" VerticalScrollBarVisibility="Visible"/>
<Image x:Name="imgLogo" Margin="134,78,120,158" Source="Logo.jpg" Stretch="Fill"/>
<Label x:Name="lblLogo" Content=" Company Title" HorizontalAlignment="Left" Margin="134,10,0,0" VerticalAlignment="Top" Width="263" Height="32" FontWeight="Bold"
FontSize="14"/>
<Button x:Name="btnEnterInfo" Content="Enter CSE Data" HorizontalAlignment="Left" Margin="21,225,0,0" VerticalAlignment="Top" Width="107" Click="btnEnterInfo_Click"/>
<Button x:Name="btnReporting" Content="Generate Reports" HorizontalAlignment="Left" Margin="283,225,0,0" VerticalAlignment="Top" Width="107" />
<Button x:Name="btnUpdate" Content="Modify CSE Data" HorizontalAlignment="Left" Margin="155,225,0,0" VerticalAlignment="Top" Width="107"/>
<Button x:Name="btnExit" Content="Exit" HorizontalAlignment="Left" Margin="419,225,0,0" VerticalAlignment="Top" Width="107" Click="btnExit_Click"/>
</Grid>
</Window>
Thanks
Ram
When I copy your code I can see the ScrollViewer but what exactly do you think it is supposed to do.
I can see by the Xaml that you are drag/dropping controls , that is ok in winforms but WPF has much better ways.
这篇关于ScrollViewer无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!