创建可扩展 WPF 用户控件的提示

2024-01-01

我是 WPF 新手。我正在创建一个应用程序,允许我控制我的 MIDI 设备。为此,我创建了一个键盘用户控件。我认为它看起来很棒,但我不知道如何设计它,以便它在绘制到窗口时可以缩放。有人可以帮忙提供修改以下 xaml 的任何提示吗?

<Grid>
    <StackPanel Orientation="Horizontal">
        <Grid>
            <Polygon Name="A0" Tag="21" Points="0,130 0,200 36,200 36,130 31,130 31,0 0,0 0,130" Stroke="Black" StrokeThickness="1" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Asharp0" Tag="22" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="31,0,0,0" />
            <Polygon Name="B0" Tag="23" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C1" Tag="24" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp1" Tag="25" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D1" Tag="26" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp1" Tag="27" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E1" Tag="28" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F1" Tag="29" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp1" Tag="30" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G1" Tag="31" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp1" Tag="32" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A1" Tag="33" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp1" Tag="34" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B1" Tag="35" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C2" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp2" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D2" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp2" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E2" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F2" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp2" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G2" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp2" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A2" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp2" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B2" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C3" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp3" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D3" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp3" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E3" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F3" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp3" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G3" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp3" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A3" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp3" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B3" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C4" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp4" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D4" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp4" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E4" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F4" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp4" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G4" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp4" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A4" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp4" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B4" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C5" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp5" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D5" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp5" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E5" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F5" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp5" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G5" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp5" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A5" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp5" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B5" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C6" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp6" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D6" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp6" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E6" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F6" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp6" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G6" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp6" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A6" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp6" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B6" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C7" Points="0,0 0,200 36,200 36,130 22,130 22,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
            <Polygon Name="Csharp7" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="22,0,0,0" />
            <Polygon Name="D7" Points="0,130 0,200 36,200 36,130 29,130 29,0 7,0 7,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="36,0,0,0" />
            <Polygon Name="Dsharp7" Points="0,0 0,130 21,130 21,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="65,0,0,0" />
            <Polygon Name="E7" Points="0,130 0,200 36,200 36,0 14,0 14,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="72,0,0,0" />
            <Polygon Name="F7" Points="0,0 0,200 36,200 36,130 21,130 21,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="108,0,0,0" />
            <Polygon Name="Fsharp7" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="129,0,0,0" />
            <Polygon Name="G7" Points="0,130 0,200 36,200 36,130 26,130 26,0 5,0 5,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="144,0,0,0" />
            <Polygon Name="Gsharp7" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="170,0,0,0" />
            <Polygon Name="A7" Points="0,130 0,200 36,200 36,130 31,130 31,0 10,0 10,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="180,0,0,0" />
            <Polygon Name="Asharp7" Points="0,0 0,130 20,130 20,0" Stroke="Black" Fill="Black" StrokeThickness="1" Width="21" Height="130" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="211,0,0,0" />
            <Polygon Name="B7" Points="0,130 0,200 36,200 36,0 15,0 15,130" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="216,0,0,0" />
        </Grid>
        <Grid>
            <Polygon Name="C8" Points="0,0 0,200 36,200 36,0" Stroke="Black" StrokeThickness="1" Width="36" HorizontalAlignment="Left" Margin="0,0,0,0" />
        </Grid>
    </StackPanel>
</Grid>

我使用了一系列堆叠的面板网格,因为我对左边距感到懒惰。如果需要的话,我不介意对其进行重组。创建一个八度音阶并以这种方式剪切+粘贴非常容易。


您可以使用ViewBox作为父容器。它将缩放您的内容StackPanel以适合窗口的大小。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

创建可扩展 WPF 用户控件的提示 的相关文章

  • XAML - 带有触发器/参数的通用文本框样式?

    我希望能够拥有一个通用样式模板 可以根据布尔值切换文本框的颜色 但我不想为每个文本框创建独特的样式 我该怎么做呢 我在下面放置了一些示例代码 我希望它如何工作 三个文本框 均具有不同的绑定 但尝试使用相同的模板基于布尔值选择红色或绿色 Th
  • 按下按钮时更改几何绘图画笔的颜色

    我创建了一个按钮模板 有一个图像和一个标签 图像的来源位于 ResourceDictionary Pictures 中 图片的来源是具有白色画笔颜色的 DrawingImage
  • WPF 按钮单击事件不起作用

    我有一个按钮 其中包含网格内的图像 我的问题是我无法制作该按钮Click活动工作 我的 XAML 代码
  • ScrollableControl 在整个控件周围绘制边框

    我正在构建基于的自定义用户控件ScrollableControl 现在我正在尝试在控件周围添加边框 类似于 DataGridView 的边框 我可以使用以下方法绘制边框 e Graphics TranslateTransform AutoS
  • 处置 StreamResourceInfo.Stream

    I use StreamResourceInfo Stream to get BitmapImage来自资源 是否正确Close and Dispose使用后的流 我问这个问题是因为在内存分析器中 如果这样做我会收到错误 内存分析器表示已处
  • WPF - 将窗口置于前面

    我有一个 WPF 窗口 我没有关闭它 相反 我执行 Hide 和 Show 它 现在 当我双击记录上网格中的主窗口时 这将触发 Show 窗口 该窗口将始终显示在主窗口后面 我尝试过以下方法 但没有成功 view Show view Act
  • 如何正确使用Dispatcher.BeginInvoke?

    我几乎在互联网上到处搜索 我用谷歌搜索了很多次并找到了很多结果 但我仍然找不到解决我的问题的方法 我正忙着改造旧的WinForms应用程序到新的 WPF 应用程序 但我在使用某些命令时遇到问题 在他们使用的 Winforms 应用程序中Co
  • WPF WebBrowser (3.5 SP1) 始终位于顶部 - 在 WPF 中显示 HTML 的其他建议

    我一直在拼命寻找一种在 WPF 应用程序中显示 HTML 的简单方法 有一些选项 1 使用WPF Web浏览器控件2 使用帧控制3 使用第三方控件 但是 我遇到了以下问题 1 WPF WebBrowser Control不是真正的WPF 它
  • tabControl/tabitem 刷新困难

    我有一个带有 maintabWindow 和几个 tabitem 的 WPF 窗口 它通常工作正常 布局是这样的 但是当我之前添加以下窗口时 结果是这样的 所以问题与 tabControl tabItem 刷新有关 这是相当明显的 但更重要
  • Prism RegionAdapter - 删除然后添加视图

    我有一个包含 AvalonDock 的 prism wpf mef 解决方案 我创建了一个RegionAdapterBase
  • WPF - 在样式中使用 ControlTemplate 资源

    创建样式时 是否可以将 ControlTemplate 属性设置为先前定义的资源 例如 如果我在 ResourceDictionary 中有以下内容
  • C#/WPF:禁用 RichTextBox 的文本换行

    有谁知道如何禁用文本换行RichTextBox 例如 如果我有一个大字符串不适合窗口 RichTextBox将字符串中无法显示的部分放在新行中 我想禁用它 并使其仅通过使用Scrollbar 多谢 Cheers A RichTextBox
  • WPF;单击 ListView 中的空白区域时如何取消选择所有选定的项目

    当我有几个 甚至一个 selected items我按简单click在我的空白处ListView 空白 非行 我想取消选择所有选定的项目 这是我取消选择所有项目的功能 private void DeselectAllListViewItem
  • 如何从页面级别获取父框架?

    我有一个带有框架和几页的窗口 加载窗口时 框架导航到欢迎页面 当我单击欢迎页面内的按钮时 我希望父框架导航到另一个页面 为此 我需要从页面级别访问父框架 但我不知道如何执行此操作 我尝试了下面的代码 但它返回 null private vo
  • 让设计者为 UserControl 的简单 List 属性生成 AddRange

    我创建了一个新的用户控件 如下所示 public partial class MyControl UserControl List
  • 控制不同的DataContext

    控制WPF中不同的DataContext 因为我可以在不同的选项卡中部署多个 DataContext 并控制当前的 DataContext 我在用着Mvvm Light WPF4我有不同的 ViewModels View 但我不知道如何处理
  • WPF - 检测鼠标按下一段时间

    检测鼠标按钮何时在特定元素上按住特定时间段的最佳方法是什么 感谢您的提示 我创建了一个附加属性以避免任何代码隐藏 using System using System Windows using System Windows Threadin
  • WPF DataGrid 绑定 DataGridCell 内容

    希望这将是一个非常简单的答案 我认为我只是没有看到众所周知的树木 我有一个 DataGridCell 样式 我想将单元格的内容绑定到图像的源属性 这是我目前使用的 XAML
  • 从 C# 检测 powerpoint 形状上的事件

    是否有可能检测在 Powerpoint 形状 例如箭头 上发生的事件 到目前为止 我发现唯一的可能性是 selectitemchanged beforerightclick 和 beforedoubleclick 但无法找到检测其他内容的方
  • 如何在 RichTextBox 中以编程方式移动插入符位置?

    我有一个 RichTextBox 其中的特殊文本位具有自定义格式 但是 存在一个错误 即插入字符后 插入符号会放置在新插入的字符之前而不是之后 这是因为对于每次编辑 代码都会重新计算内容以应用自定义格式 然后像这样设置 CaretPosit

随机推荐

  • .NET MAUI 中的 Android 深度链接(意图)支持

    我目前正在尝试向使用 NET MAUI 编写的 Android 应用程序添加深度链接支持 通过 Intents 我添加了一个activityXML 元素下应用我的 AndroidManifest xml 中的元素
  • 使用 NGINX 将 Gatsby 托管在子目录上

    我如何使用 nginx 将 gatsby js 托管在子目录上 我已经尝试过使用proxy pass http 127 0 0 1 8000 with gatsby develop但我遇到了 Socket io 的问题 有谁知道如何在我尝试
  • GetMessage 超时

    我有一个第二个线程调用的应用程序GetMessage 循环中 在某个时刻 第一个线程意识到用户想要退出应用程序并通知第二个线程它应该终止 由于第二个线程被卡住GetMessage 程序永远不会退出 有没有办法让消息超时等待 我也对其他想法持
  • 使用 OrderBy、ThenBy 排序

    我正在尝试根据先前排序的列对表的几列进行排序 它对于前两列效果很好 但是 一旦我对第三列进行排序 第二列就会失去排序 据我目前所知 我的 foreach 循环一定有问题 这是我的排序代码 public List inhaltSortiere
  • gif动画完成时触发javascript

    我有一个网站 上面有一个不重复的 gif 所以看起来正在加载 我想要一个 javascript 脚本来检测 gif 动画何时完成 然后重定向到另一个站点 这可能吗 我不能只将其设置为 5 秒 因为不同的计算机 平板电脑在不同的时间加载它 如
  • [React]将异步数据获取到组件中的不同方式

    我对 React 世界有点陌生 最近当我开始在组件内编写 Ajax 内容时 我感到很困惑 据我所知 这里有两种渲染方式异步将数据放入组件中 如下所示 1st way class MyComponent extends React Compo
  • 使用 free() 时出现分段错误

    此代码会导致分段错误 int main char p char a 50 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa p char malloc 50 sizeof char if p
  • “[文章] 使用 WSO2 API Manager 启用 API 货币化”相关问题

    我尝试根据文章将 POC WSO2 APIM 与计费引擎集成1 http wso2 com library articles 2016 07 article enabling monetization of apis with wso2 a
  • 将值和数字格式从一个范围复制到另一个范围?

    下面的行没有出现错误 我将值从一个范围复制到另一个范围 ThisWorkbook Sheets Output Range F lastRowOutput 1 M lastRowOutput 1 Value projectWb Sheets
  • 使用 Zoom SDK 最小化视频通话和共享视图

    我正在尝试将 Zoom SDK 会议集成到 Android 应用程序中 我已经努力使用自定义会议用户界面并学习如何使用 Zoom 的视频视图 称为MobileRTCVideoView 这是我想创建的界面 我尝试过的 研究了 Zoom 的示例
  • 在本机 C++ 中锁定 GDI+ 位图?

    我可以找到很多关于如何在托管 c 中执行此操作的示例 但没有找到非托管的示例 我希望尽可能高效地获取所有像素数据 但我需要更多有关 scan0 内容的一些信息 以便我可以正确地迭代像素数据并从中获取每个 rgba 值 现在我有这个 Bitm
  • lxml 在 Solaris 10 上构建

    请您就 python 2 6 6 和 lxml Solaris 10 构建问题提供帮助和建议吗 安装说明 www sunfreeware com download html 直接链接到文件 http www sunfreeware com
  • CSS 动画 onclick 和反转 next onclick

    我正在使用精灵表和关键帧在单击按钮时为按钮上的图像设置动画 当单击按钮时 我希望帧沿一个方向运行 并将按钮保留在精灵表中的最后一个图像上 当再次单击按钮时 我希望相同的帧向后运行 将按钮保留在精灵表中的第一个图像上精灵表 我目前正在尝试使用
  • 将更新的函数传递给现有函数

    在这个简短的序列中 用户创建了一个函数userfunc 但随后想要更新第一个定义以执行不同的操作 但是 那programfunc 已经编译了第一个版本 并继续使用它 userfunc str n str n userfunc hello 3
  • 处理 iOS 和 Android 上的推送通知场景

    我想为应用程序 iOS 和 Android 实现推送通知 并需要澄清以下场景 我了解推送通知的一般工作原理和局限性 我确实阅读了文档 但这让我感到困惑 并且没有回答我所有的问题 iOS 和 Android 中如何处理以下场景 当设备关闭时
  • 单声道安卓。单元测试框架[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 是否有一些支持单声道 Android 应用程序的单元测试框架 我已经尝试过默认的 Visual Studio 测试框架和 NUnit 框架
  • 多个 ssh 密钥

    好吧 我在 ssh 帖子中看到了拥有多个私钥的答案 但我没有获得足够的声誉来添加任何评论 所以我必须写一个新问题 对此感到抱歉 在帖子中 给出的答案是配置文件 用于将每个主机 用户名定向 指向 它应该使用的私钥文件 但是有没有办法拥有一个供
  • 面板.repaint();打乱布局

    JPanel启动 p new JPanel private static final long serialVersionUID 1L public void paintComponent Graphics g if errors 1 g
  • 使用 SSIS 发送邮件任务发送邮件

    我想使用 SSIS 发送带有附件的电子邮件 但出现以下错误 发送邮件任务 错误 发生错误并出现以下错误 消息 SMTP 服务器需要安全连接 否则客户端 未经过验证 服务器响应为 5 5 1 身份验证 必需的 了解更多信息 请访问 下面是我的
  • 创建可扩展 WPF 用户控件的提示

    我是 WPF 新手 我正在创建一个应用程序 允许我控制我的 MIDI 设备 为此 我创建了一个键盘用户控件 我认为它看起来很棒 但我不知道如何设计它 以便它在绘制到窗口时可以缩放 有人可以帮忙提供修改以下 xaml 的任何提示吗