首页 > 其他分享 >Avalonia UserControl Grid布局

Avalonia UserControl Grid布局

时间:2025-01-11 09:46:02浏览次数:1  
标签:vm Grid UserControl 工具 YourNameSpace Avalonia

<!-- 定义列 -->
<Grid.ColumnDefinitions>
  <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<!-- 按钮区域 -->
  <StackPanel Orientation="Horizontal" Grid.Row="0">
    <TextBlock Padding="5,15" Grid.Row="0" Grid.Column="0">
      <StackPanel Grid.Row="0" Grid.Column="0">
        <TextBlock FontSize="18" Margin="15,5">XXXXXX V1.0</TextBlock>
        <TextBlock FontSize="10" Margin="15,5">XXXXXXXXX.</TextBlock>
      </StackPanel>
    </TextBlock>

    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="DBPage" Background="Transparent" Grid.Row="0" Grid.Column="1" Cursor="Hand" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/database.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">DB工具</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="DevicePage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/tree.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">设备中心</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="DataPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/data-recive.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">数据采集</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="MQTTPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/MQTT.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">MQTT</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="TCPPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/TCP.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">TCP</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="SSHPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/ssh.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">SSH</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="SerialPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/serial-port.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">串口工具</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="VersionPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/version_line.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">应用版本</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="DockerPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/docker.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">镜像管理</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="BugPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/debug.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">爬虫工具</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="KeyPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/key.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">密钥中心</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="DevPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/dev.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">开发调试</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="SettingPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/setting.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">系统配置</TextBlock>
      </StackPanel>
    </Button>
    <Border Width="1" Height="32" Background="#424242" Margin="1,0"/>
    <Button Tag="OtherPage" Background="Transparent" Cursor="Hand" Grid.Row="0" Grid.Column="2" Click="Button_Click">
      <StackPanel>
        <Image Source="avares://AvaToolPro/Assets/Icons/index/other.png" Margin="0,15,0,5" Width="30" Height="30"/>
        <TextBlock FontSize="12" TextAlignment="Center">其他功能</TextBlock>
      </StackPanel>
    </Button>
    <!-- 可以添加更多按钮 -->
  </StackPanel>
<!-- 分隔线 -->
<Border Grid.Row="1" Background="#252525" Height="1"/>
<!-- 内容展示区域 -->
<ContentControl Content="{Binding IndexContentControl}" Grid.Row="2"/>

中需要添加的属性
xmlns:vm="using:YourNameSpace.ViewModels"
x:DataType="vm:YourViewModel"
x:Class="YourNameSpace.ThisName"

标签:vm,Grid,UserControl,工具,YourNameSpace,Avalonia
From: https://www.cnblogs.com/ff-king/p/18665196

相关文章

  • WPF 怎么利用behavior优雅的给一个Datagrid添加一个全选的功能
    前言:我在迁移旧项目代码的时候发现别人写很多界面都涉及到一个DataGrid的全选,但是每个都写的很混乱,现在刚好空闲下来,写一个博客,给部分可能不太会写这个的同学讲一下,怎么实现全选功能,并且可以在任何项目里面复用这个功能。先准备一个Datagrid,我们给这个DataGrid取名为dg1。......
  • CDS标准视图:应收账龄表 I_ARJrnlEntrItmAgingGrid
    视图名称:应收账龄表I_ARJrnlEntrItmAgingGrid视图类型:参数视图代码:点击查看代码@AbapCatalog.sqlViewName:'IARJEITMAGGRID'@AbapCatalog.compiler.compareFilter:true@AbapCatalog.preserveKey:true@VDM.viewType:#COMPOSITE@EndUserText.label:'AgingGridofAcco......
  • D. Smithing Skill 和 D. Grid Puzzle的题解
    D.SmithingSkill:https://codeforces.com/problemset/problem/1989/D思路:https://blog.csdn.net/weixin_73936404/article/details/140045020(看这位的博客吧,这个本人第一次写卡住了,题解就当复盘了)贪心:优先消耗值小的(花费和返回的差值)且门槛小的。代码:#include<bits/stdc......
  • DevExpress WinForms 中文教程:Grid View - 列选择器 API
    DevExpressWinForms拥有180+组件和UI库,能为WindowsForms平台创建具有影响力的业务解决方案。DevExpressWinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!在本教程中,我们将带您了解如何使用DevExpressWinF......
  • Harmony开发-ArkUI框架速成十二Grid网格布局
    程序员Feri一名12年+的程序员,做过开发带过团队创过业,擅长Java、嵌入式、鸿蒙、人工智能等,专注于程序员搞钱那点儿事,希望在搞钱的路上有你相伴!君志所向,一往无前!网格布局Grid1.Grid如果布局是由很多的行和列所组成、行列可能需要合并、甚至滚动,就可以使用网格......
  • 【c# WPF贪吃蛇教程】Grid与UniformGrid一对异姓兄弟在二维世界玩蛇之幻觉让我骑大蛇
    前言    经过前面两次的贪吃蛇项目,我已经完全掌握了突破二维次元的绝对力量,一定要把小蓝(一只老鼠)从次壁中解救出来,键盘磨出的斑驳深痕被老祖的天门法眼洞悉,赐予我两枚绝域神器,分别是Grid和UniformGrid,奈何不好驾驭,但也阻挡不了我战胜蛇蛇的决心。。。    项......
  • DevExpress WinForms中文教程:Grid View - 如何实现列的可见性
    DevExpressWinForms拥有180+组件和UI库,能为WindowsForms平台创建具有影响力的业务解决方案。DevExpressWinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!本文将为大家介绍如何使用DevExpressWinFormsDat......
  • opencv中findCirclesGrid在标定时使用,blobDetector 参数怎么定义?
    在OpenCV中,findCirclesGrid是一个用于检测图像中的圆形格点(通常用于相机标定或校正的检测目标)的函数。它可以用于查找在特定模式下排列的圆形图案,如棋盘格或圆形网格。该函数是相机标定和立体视觉的重要工具。函数原型boolcv::findCirclesGrid(InputArrayimage,S......
  • WPF add System.Windows.Forms.PropertyGrid via WindowsFormsHost
    1.AddreferenceSystem.Windows.Forms.dll;2.Addreference C:\ProgramFiles\ReferenceAssemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll3.//xaml<Windowx:Class="WpfApp131.MainWindow"xmlns="http://schemas.mi......
  • WPF call Windows.Forms.PropertyGrid in xaml
    1.AddreferenceSystem.Windows.Forms;2.Addreference C:\ProgramFiles\ReferenceAssemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll3.<Windowx:Class="WpfApp132.MainWindow"xmlns="http://schemas.microsoft.com......