zoukankan      html  css  js  c++  java
  • silverlight 转换器 GLenn

    ConvtoBSfcodeToStr.cs

    namespace SilverlightApplication1
    {
        public class ConvtoBSfcodeToStr : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return (value.ToString().Length < 20 ? value.ToString() : value.ToString().Substring(0,20));
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
    
                return (value.ToString().Length < 20 ? value.ToString() : value.ToString().Substring(0, 20)+"...");
            }
        }  
    }

    xaml:

                         xmlns:localConv="clr-namespace:SilverlightApplication1"
    
                         <localConv:ConvtoBSfcodeToStr x:Key="ConverBStoStr"></localConv:ConvtoBSfcodeToStr>

    使用时 先转换为模板列 Converter={StaticResource ConverBStoStr}

    <data:DataGridTemplateColumn Header="内容" Width="1.0*">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Name="tool"  Text="{Binding ArticleContent, Mode=TwoWay, Converter={StaticResource ConverBStoStr}}">
                                    <ToolTipService.ToolTip>
                                        <ToolTip MaxWidth="500">
                                             <TextBlock Text="{Binding ArticleContent}"  TextWrapping="Wrap"/>
                                        </ToolTip>
                                    </ToolTipService.ToolTip>
                                    </TextBlock>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>
  • 相关阅读:
    java操作docker示例(docker-java)
    istio实现对外暴露服务
    istio实现自动sidecar自动注入(k8s1.13.3+istio1.1.1)
    k8s1.13.3安装istio(helm方式)
    wrk http压测工具介绍
    etcd 相关介绍
    openresty 常用API学习
    Lua 相关知识点
    Lua 获取table的长度
    Lua 字符串相关操作
  • 原文地址:https://www.cnblogs.com/cuiguangzhi/p/2638104.html
Copyright © 2011-2022 走看看