我有一个WPF Datagrid,它有一个Collection View Source,上面有3个级别的分组.
我已经设置了datagrid样式以使用3个扩展器,使它看起来像这样:
Level 1 Expander
<content>
Level 2 Expander
<content>
Level 3 Expander
<content>
Run Code Online (Sandbox Code Playgroud)
2级和1级只是组的标题
我有第二个控件允许用户显示和隐藏3级项目,这些项目通过将Level 3扩展器绑定到后面对象中的布尔"IsVisible"属性来工作.
<!-- Style for groups under the top level. this is the style for how a sample is displayed -->
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<!-- The parent control that determines whether or not an item needs to be displayed. This holds all of the sub controls displayed for a sample …
Run Code Online (Sandbox Code Playgroud) 我正在使用Expander
控件并设置了标题,如下图所示:
http://www.hughgrice.com/Expander.jpg
Expander
我遇到的问题是我希望扩展器按钮包含在标题中,以便标题模板末尾的行与内容对齐,即我最终想要得到类似于下图的内容:
http://www.hughgrice.com/Expander.gif
提前致谢.
我想将Expander按钮放在标签的右侧.这该怎么做?
我有一个带有一组扩展器的StackPanel,如何设置它以便任何时候只展开扩展器?
干杯
AW
我设置IsTabStop
到False
,但Tab
仍导航到扩展.
有什么想法我做错了什么?
<Expander Header="Data" IsTabStop="False">
<Border Background="White" BorderThickness="0"/>
</Expander>
Run Code Online (Sandbox Code Playgroud) 有人(可能使用Blend)为WPF Expander提供了一个有效的默认ControlTemplate吗?我想做一些细微的修改,但似乎我找不到有效模板的来源.
提前致谢.
这个问题与其他未回答的问题相同.
当扩展扩展外ListView的增长,使空间的扩展内容,但在扩展随后倒塌的观点并不强制ListView控件来调整.
减少代码,注释后:
<!--<StackPanel>-->
<ItemsControl>
<!-- ParameterGroupView -->
<Border BorderBrush="Brown" BorderThickness="1" CornerRadius="4" Padding="4">
<ListView HorizontalContentAlignment="Stretch">
<Expander Header="Expander A" IsExpanded="False">
<ListView HorizontalContentAlignment="Stretch">
<!-- TextView -->
<TextBlock >Content A</TextBlock>
<TextBlock >Content B</TextBlock>
</ListView>
</Expander>
</ListView>
</Border>
</ItemsControl>
<!--</StackPanel>-->
Run Code Online (Sandbox Code Playgroud)
我在ItemsControl或StackPanel中有ParameterGroupView,因为实际上有很多ParameterGroupView条目.交换到StackPanel不会改变行为.
删除边界不会影响行为,但让它只显示一个ParameterGroupView的行为.
可以有很多扩展外部分的ListView和扩展可以让内内许多实体的ListView.
外部ListView和Expander是替换一个TreeView,它曾经有一个可折叠节点列表,但TreeView内部使用了网格,意味着TextView项目被横向压缩,就像删除了以下的一样: …
我有一个带可扩展面板(via Expander
)的WPF窗口.面板位于窗口的左侧,展开后窗口会增大以适应内容.
默认情况下,窗口固定在左上角,因此我的窗口向右移动.我希望窗户向左侧增长.
我试图在Window.SizeChanged
事件中做以下事情:
private void onWindowSizeChanged(object sender, SizeChangedEventArgs e)
{
Left -= (e.NewSize.Width - e.PreviousSize.Width)
}
Run Code Online (Sandbox Code Playgroud)
它有效,但增长不稳定,我想找到一个更顺畅的解决方案.
我有多个扩展器,我正在寻找一种方法来折叠所有其他扩展器,当其中一个扩展时.我在这里找到了这个解决方案
<StackPanel Name="StackPanel1">
<StackPanel.Resources>
<local:ExpanderToBooleanConverter x:Key="ExpanderToBooleanConverter" />
</StackPanel.Resources>
<Expander Header="Expander 1"
IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=1}">
<TextBlock>Expander 1</TextBlock>
</Expander>
<Expander Header="Expander 2"
IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=2}">
<TextBlock>Expander 2</TextBlock>
</Expander>
<Expander Header="Expander 3"
IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=3}">
<TextBlock>Expander 3</TextBlock>
</Expander>
<Expander Header="Expander 4"
IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=4}">
<TextBlock>Expander 4</TextBlock>
</Expander>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
public class ExpanderToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (value …
Run Code Online (Sandbox Code Playgroud) expander ×10
wpf ×10
c# ×4
xaml ×3
listview ×1
mvvm ×1
resize ×1
silverlight ×1
stackpanel ×1
tabstop ×1
wpf-controls ×1