• 记录WPF的技巧(二)16-30


    目录

    16.wpf鼠标滑动有提示功能

    17.wpf全局使用样式的设置


    16.wpf鼠标滑动有提示功能

    比如鼠标在某一个控件上面滑动,会出现文字提示的功能

    只需要对控件增加ToolTip即可

    1. "trvPersons" Width="150" Height="200" Foreground="#FF05C7CB" BorderBrush="#00ACACAC" Background="#004682B4" >
    2. "{Binding Children}">
    3. "Horizontal" ToolTip="{Binding Name,NotifyOnSourceUpdated=True}">
    4. "/TreeView;component/Images/1.png" Margin="0,0,5,0" />
    5. "{Binding Name}" Margin="0,0,4,0" Foreground='#FF05C7CB' />

    17.wpf全局使用样式的设置

     有时候,我们需要一个样式,全局使用,按照以下方式配置,使用button举例

    1. "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    引用

    1. "DataGrid.App"
    2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    4. xmlns:local="clr-namespace:DataGrid"
    5. StartupUri="MainWindow.xaml">
    6. "pack://application:,,,/DataGrid;component/Button.xaml"/>

    如果单个界面使用,那么需要加上key

    引用不变 

    在使用的界面中加入下面代码

    1.    
    2.        
    3.    

    如果是在某一个控件上面使用,只需要把  删除掉,其他一样,再在对应的控件上面加上下面代码

    1. Width="80" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center">

     

  • 相关阅读:
    【机器学习】【深度学习】批量归一化(Batch Normalization)
    精讲算法的时间复杂度
    MySQL集群高可用架构之MMM
    12-面试官:如何使用线程池执行定时任务?
    【InnoDB Cluster】修改已有集群实例名称及成员实例选项
    玩转数据可视化之R语言ggplot2:(九)网络图绘制
    perf 常见使用方法
    掉瓶子小游戏
    ansible学习笔记【14】lvg模块、lvol模块
    C++单例模式与工厂模式
  • 原文地址:https://blog.csdn.net/u012563853/article/details/126179606