【发布时间】:2019-07-16 15:17:47
【问题描述】:
如何自动调整用户控件的大小以适应 DevExpress Dock LayoutPanel 的大小?我尝试了以下方法,但它不起作用。当我通过鼠标调整布局面板的大小时,面板内的用户控件应该会相应地拉伸以适应面板。
在我的父控件 XAML....\
<dxdo:DockLayoutManager>
<dxdo:LayoutGroup x:Name="RootGroup" VerticalAlignment="Stretch">
<dxdo:LayoutPanel x:Name="FundMapPanel" Caption="Fund Map" ItemWidth="400" ItemHeight="320">
<cont:FundMapUserControl></cont:FundMapUserControl>
</dxdo:LayoutPanel>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
在我的用户控制 XAML 中..
<UserControl
. . .
. . .
Width="{Binding ElementName=FundMapPanel, Path=ItemWidth, Mode=TwoWay}"
Height="{Binding ElementName=FundMapPanel, Path=ItemHeight, Mode=TwoWay}"
. . .
. . .
</UserControl>
【问题讨论】:
-
你试过
RelativeResouce和ParentType吗?或者也许只是删除Width和Height并将VerticalAlignment和HorizontalAligment设置为Stretched? -
是的,这是有效的。谢谢!
标签: wpf user-controls devexpress