• 最近涉及到的一些需要备忘的东西


    1.WPF ScrollViewer 关于设置滚动位置不起作用的解决办法

      首先需要调用UpdateLayout() 此时才会更新改变后(例如显示区域大小变化)等信息

      然后在调用scrollViewer.ScrollToHorizontalOffset(double d) 或者其他类似的方法即可

    2.关于使用Excel作为数据源问题 出现“未在本地计算机上注册microsoft.ace.12.0”的问题

     首先确定你的机器是不是64位系统 如果是请将项目生成的目标平台改为x86

       若果还是出现该问题 请到去http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463960fdcdb/AccessDatabaseEngine.exe下载安装之后即可

    3.DEVExpress For WPF 中Gridcontrol如何根据内容让整行变色

    1 <Style x:Key = "RowStyle" BasedOn = "{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}" TargetType = "{x:Type dxg:GridRowContent}">
    2              <Setter Property = "Background" Value="{Binding Row, Converter={StaticResource alarmLevelConverter}}"/>
    3 <!--或者
    4 <Setter Property = "Background" Value="{Binding Path=DataContext.字段名, Converter={StaticResource alarmLevelConverter}}"/>
    5 --> </Style>

    里面需要转换器 

     1      [ValueConversion(typeof(AlarmHappeningClass), typeof(Brush))]
     2   
     3       public class AlarmLevelConverter : IValueConverter
     4       {
     5   
     6           public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
     7           {
     8               AlarmHappeningClass alarmrow = value as AlarmHappeningClass;
     9               if (alarmrow == null)
    10                  return Brushes.Transparent; ;
    11              if (alarmrow.AlarmLevel=="紧急")
    12                  return Brushes.Red;
    13              else if (alarmrow.AlarmLevel == "重要")
    14                  return Brushes.Orange;
    15              return Brushes.Transparent;
    16          }
    17  
    18          public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    19          {
    20              throw new NotSupportedException();
    21          }
    22  
    23      }

    这部分代码来自于http://www.bubuko.com/infodetail-508440.html

    如果是绑定字段的话就不用那么麻烦了 value就是字段值

  • 相关阅读:
    Canvas与Paint的0基础使用
    PHP经常使用功能
    java枚举在android项目应用
    POJ1833 &amp; POJ3187 &amp; POJ3785 next_permutation应用
    usb芯片调试经验
    Equals和==比較
    JSTL标准标签库具体解释
    零基础学python-3.3 标识符
    用react native 做的一个推酷client
    Linux异常关机后,Mysql启动出错ERROR 2002 (HY000)
  • 原文地址:https://www.cnblogs.com/lgmbk/p/5318188.html
Copyright © 2020-2023  润新知