本文介绍了Silverlight Tab项目的高度和宽度在运行时无法访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我在silverlight中有一个Tab Control。 在我的标签中有2个标签项。在tab-1和tab-2中,我将运行时控件添加到Canvas中。我在标签旁边有一个保存按钮。我的Xaml页面如, < UniControls:UniTabControl 背景 = 透明 ReorderTabRows = False Horizo​​ntalAlignment = Stretch VerticalAlignment = 拉伸 保证金 = 0, 0,5,0 BorderThickness = 1 > < UniControls:UniTabItem 标题 = 表单-1 TabIndex = 0 宽度 = 130 MinHeight = 22 VerticalAlignment = 中心 Horizo​​ntalContentAlignment = 中心 BorderThickness = 0 保证金 = 0 IsSelected = True > < Canvas / > < / UniControls:UniTabItem > < UniControls:UniTabItem 标题 = Form-1 TabIndex = 0 宽度 = 130 MinHeight = 22 VerticalAlignment = 中心 Horizo​​ntalContentAlignment = 中心 BorderThickness = 0 保证金 = 0 IsSelected = True > ; < Canvas / > < / UniControls:UniTabItem > < / UniControls:UniTabControl > 当我按下保存按钮并且我的标签-2处于活动状态时,我从画布获得了所有控制但是所有控件的实际高度/高度和实际宽度/宽度是0.如果我的tab-1处于活动状态,那么我从实际高度/高度和实际宽度/宽度获得值。 请帮帮我。解决方案 RadTabControl的默认行为是在VisualTree中仅保留其SelectedTab的内容。 但是如果你想保留你已经选择的RadTabItem的内容,你可以设置RadTabControl的 IsContentPreserved = true 属性。 / BLOCKQUOTE> Hello all,I have one Tab Control in silverlight. In my tab there are 2 tab item. In tab-1 and tab-2, i am adding run time control into Canvas. And i have one Save button out side of tab. My Xaml page like,<UniControls:UniTabControl Background="Transparent" ReorderTabRows="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,5,0" BorderThickness="1" > <UniControls:UniTabItem Header="Form-1" TabIndex="0" Width="130" MinHeight="22" VerticalAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="0" Margin="0" IsSelected="True"> <Canvas/> </UniControls:UniTabItem> <UniControls:UniTabItem Header="Form-1" TabIndex="0" Width="130" MinHeight="22" VerticalAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="0" Margin="0" IsSelected="True"> <Canvas/> </UniControls:UniTabItem> </UniControls:UniTabControl>When i press save button and my tab-2 is active that time i got all the control from canvas but all control's actual-height/height and actual-width/width is 0. If my tab-1 is active that time i got value from actual-height/height and actual-width/width.Please help me. 解决方案 The default behavior of the RadTabControl is to keep only the content of its SelectedTab in the VisualTree. However if you want to keep the content of the RadTabItem which you have already selected you can set the IsContentPreserved = true property of the RadTabControl. 这篇关于Silverlight Tab项目的高度和宽度在运行时无法访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-15 19:48