我已经通过了很多示例代码,最后决定问这个问题:我有一个网格,其中有一个固定位置的按钮,里面有另一个网格.外部网格没有设置宽度/高度.它应该根据显示分辨率进行更改.我将窗口的W/H设置为:
Width = 200;
Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 5;
Run Code Online (Sandbox Code Playgroud)
在内部网格内部我有3行,上部是一个按钮(高度自动),中间一个是列表视图,其高度可能会变化(并且必须填充可用空间),最后一行包含一个文本框总是留在窗户的底部.该xaml如下:
<Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="Button_Click" Width="32" Height="32" FontSize="16" VerticalAlignment="Center"
HorizontalAlignment="Left" FontWeight="Bold" ToolTip="Click here to hide the Sidebar">></Button>
<Grid VerticalAlignment="Top" Background="Transparent" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<!-- This is the settings bar-->
<RowDefinition Height="*" />
<!-- This will contain the listbox-->
<RowDefinition Height="Auto" />
<!-- This is to maintain vertical arrangement and future use-->
</Grid.RowDefinitions>
<Button Content="hello" Grid.Row="0" />
<ListView x:Name="lstView" Background="Transparent" Grid.Row="1"/>
<TextBox TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="50" Margin="2" BorderBrush="Black" …Run Code Online (Sandbox Code Playgroud) 我想要做的是在WPF中创建一个桌面应用程序,其UI是一个小图标将保持固定在屏幕左边缘的中心,点击(或可能悬停)将滑动打开侧边栏(如谷歌桌面栏)沿着屏幕的左边缘运行(固定位置,不能移动).
请注意,我要求的可能就像一个appbar但我不希望左侧边缘的桌面图标移动,因为它发生在appbar,即我不希望它占用桌面空间... .can有人请建议我出路吗?
我用这个实现了部分解决方案,但是我无法获得幻灯片动画和固定位置来锻炼