我是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/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代码
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.
现在我想在winform应用程序时调整wpf控件的大小。窗口调整大小。 tabpage调整大小但wpf控件没有。 我该怎么做。??
窗口全尺寸时的tabpage屏幕截图
窗口调整大小时
请帮忙。