有关扩展器控制的问题 [英] Question regarding Expander Control
问题描述
如果由另一个控件触发,我如何让我的扩展器控件自动扩展并启用自身。
例如:用户单击OK(其他控件)
Expander Control启用(可由用户单击)扩展..在扩展框中显示内容。
Thx~
Hi, how can I make my expander control to auto expand and enable itself if it is triggered by another control.
Ex: User clicks OK (other control)
Expander Control enables (clickable by user) expands.. shows content in expanded box.
Thx~
推荐答案
试试这个,看看这是否符合您的需求
网格 >
将以下代码放入网格如图所示
<
< 扩展器 标题 =" Checker" x : 姓名 =" expTester">
< StackPanel >
< RadioButton Content =" One" />
< RadioButton 内容 =" Two" />
< RadioButton 内容 =" Three" />
< RadioButton 内容 =" Four" />
< / StackPanel >
< / Expander >
< ; 按钮 x : 名称 =" btnTest" 宽度 =" 100" 高度 =" 30" < font color ="#ff0000"size = 2>内容 =" _Click Me" 点击 =" btnTest_Click" />
< / 网格 >
然后在你的代码中尝试以下内容,我有在这里显示VB
Try this and see if this fits your needs
Grid>
Put the following code into the grid as shown
<
<Expander Header="Checker" x:Name="expTester">
<StackPanel>
<RadioButton Content="One"/>
<RadioButton Content="Two"/>
<RadioButton Content="Three"/>
<RadioButton Content="Four"/>
</StackPanel>
</Expander>
<Button x:Name="btnTest" Width="100" Height="30" Content="_Click Me" Click="btnTest_Click"/>
</Grid>
then try the following in your code, I have shown VB here
私人 Sub btnTest_Click( ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
expTester.IsExpanded = < font color ="#0000ff"size = 2> True
End Sub
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
expTester.IsExpanded = True
End Sub
我希望这有助于
Stephen。
这篇关于有关扩展器控制的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!