C# 当Winform应用程序调整大小时,如何调整Winform中使用的WPF用户控件的大小
我是wpf新手,在C# 当Winform应用程序调整大小时,如何调整Winform中使用的WPF用户控件的大小,c#,.net,wpf,xaml,telerik,C#,.net,Wpf,Xaml,Telerik,我是wpf新手,在system.windows.forms.tabpage中的winform应用程序中使用wpf用户控件 wpf控制代码 <UserControl x:Class="VMS_TimelineControl.WpfTimeline" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com
system.windows.forms.tabpage
中的winform应用程序中使用wpf用户控件
wpf控制代码
<UserControl x:Class="VMS_TimelineControl.WpfTimeline"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VMS_TimelineControl"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d" Height="161" Width="1135" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="usercontrol">
<Grid Name="grid" Margin="0,0,10.085,0.489" Height="153" Width="1125">
<Grid.Resources>
</Grid.Resources>
<telerik:RadTimeline x:Name="Timeline" Height="153" Width="1125"
</telerik:RadTimeline>
</Grid>
</UserControl>
现在我想在winform应用程序启动时调整wpf控件的大小。窗口已调整大小。选项卡页会调整大小,但wpf控件不会。
我该怎么做
tabpage窗口全尺寸时的屏幕截图
当窗口调整大小时
请帮忙 不确定这是否是您所需要的,但尝试将
telerik:RadTimeline
包装在视图框中
@Pragmateek我可以将的高度
和宽度
属性绑定到选项卡页的高度和宽度吗?可能,但我认为您应该尝试使用布局组件,如ScrollViewer
或ViewBox
。要测试它们,您只需将您的telerik:RadTimeline
包装在其中。你会很快看到一个是否适合你的需要。。。或者没有:)@Pragmateek我试过Viewbox
,但它不适合我的需要。我不想使用ScrollViewer
,因为时间线已经有了自己的滚动条。
timeLine = new WpfTimeline();
TimeLineData data = new TimeLineData();
data.startdate = StartTime;
data.enddate = EndTime;
data.DataToPlot = events;
timeLine.DataContext = data;
timeLine.SendEventDateTime += TimeLinePlayVideo;
//Elementhost ----> host for timeline control in winforms
this.timelineHost.Height = ((int)timeLine.Height) + 10;
this.timelineHost.Width = (int)timeLine.Width;
this.timelineHost.Child = timeLine;
this.timelineHost.BringToFront();
tabPage1.Controls.Add(this.timelineHost);
//tabPage1 is the tab inside whos tabpage this wpf control is hosted.