所以我有一个包含多个listboxItems的列表框,但是最后一个Item Name" ExampleBottom"需要处于底部而其他人需要保持在最顶层。我试过verticalalign,但这不起作用。
<SplitView.Pane>
<ListBox SelectionMode="Single"
SelectionChanged="ListBox_SelectionChanged"
Background="#333333"
Foreground="White">
<ListBoxItem Name="Example1">
<StackPanel Orientation="Horizontal">
<TextBlock>Example</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="Example2">
<StackPanel Orientation="Horizontal">
<TextBlock>Example</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="Example3">
<StackPanel Orientation="Horizontal">
<TextBlock>Example</TextBlock>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="ExampleBottom" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<TextBlock>Example</TextBlock>
</StackPanel>
</ListBoxItem>
</ListBox>
</SplitView.Pane>
答案 0 :(得分:0)
我认为你没有用列表框完成这件事。我会使用一个网格,然后在中间有一个空行,但你需要实现自己的选择机制,然后
答案 1 :(得分:0)
我使用RelativePanel
内的2个列表框完成了此操作。
让第一个ListBox有一个RelativePanel.AlignTopWithPanel = "True"
让第二个ListBox有一个RelativePanel.AlignBottomWithPanel = "True"
接下来,如果您希望它看起来无缝,请确保相对面板的背景颜色与ListBox相同。
<SplitView.Pane>
<RelativePanel Background="Black">
<ListBox SelectionMode="Single"
Name="IconsListBox"
SelectionChanged="ListBoxSelectionChanged"
Background="Black"
RelativePanel.AlignTopWithPanel="True">
<ListBoxItem Name="HomeListBoxItem"
ToolTipService.ToolTip="Home"
PointerEntered="HamburgerMenuItemPointerEntered"
PointerExited="HamburgerMenuItemPointerExited">
<StackPanel Orientation="Horizontal">
<TextBlock
Foreground="White"
FontFamily="Segoe MDL2 Assets"
FontSize="16"
Text="" />
<TextBlock
Foreground="White"
Text="Home"
FontSize="16"
FontFamily="Arial"
Margin="20,0,0,0" />
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="SecondListBoxItem"
ToolTipService.ToolTip="2nd Item"
PointerEntered="HamburgerMenuItemPointerEntered"
PointerExited="HamburgerMenuItemPointerExited">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="White"
FontFamily="Segoe MDL2 Assets"
FontSize="16"
Text="" />
<TextBlock
Foreground="White"
Text="Dosimetry"
FontFamily="Arial"
FontSize="16"
Margin="20,0,0,0" />
</StackPanel>
</ListBoxItem>
</ListBox>
<ListBox SelectionMode="Single"
Name="BottomListBox"
SelectionChanged="ListBoxSelectionChanged"
Background="Black"
RelativePanel.AlignBottomWithPanel="True">
<ListBoxItem Name="UserListBoxItem"
ToolTipService.ToolTip="Dosimetry"
PointerEntered="HamburgerMenuItemPointerEntered"
PointerExited="HamburgerMenuItemPointerExited"
VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="White"
FontFamily="Segoe MDL2 Assets"
FontSize="16"
Text="" />
<TextBlock
Foreground="White"
Text="User"
FontFamily="Arial"
FontSize="16"
Margin="20,0,0,0" />
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="SettingsListBoxItem"
ToolTipService.ToolTip="Dosimetry"
PointerEntered="HamburgerMenuItemPointerEntered"
PointerExited="HamburgerMenuItemPointerExited">
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="White"
FontFamily="Segoe MDL2 Assets"
FontSize="16"
Text="" />
<TextBlock
Foreground="White"
Text="Settings"
FontFamily="Arial"
FontSize="16"
Margin="20,0,0,0" />
</StackPanel>
</ListBoxItem>
</ListBox>
</RelativePanel>
</SplitView.Pane>