zoukankan      html  css  js  c++  java
  • gridview 选中某行后 某行的按钮显示,无选中则隐藏

    如后面的加号,选中行时出现,未被选中的隐藏

    解决:

    在按钮中的visibility属性中绑定该item是否选中,再用转换器转换

        <Button Name="btnA" Click="btnA_Click_1" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListViewItem}, Path=IsSelected,Converter={StaticResource btnshowConverter}}">+</Button>

    public class btnshowConverter : IValueConverter
     {
           public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
          {
                 if (value.ToString() == "True") return "Visible";
                 if (value.ToString() == "False") return "Collapsed";
                 return value;
          }
          public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
                 throw new NotImplementedException();
         }
    }

  • 相关阅读:
    body test
    menu
    Toolbutton test itk_component
    grid pack
    double inherit
    set font
    Activity test itk_component
    Activity test no class
    按键驱动调试总结
    system.img解包打包的方法
  • 原文地址:https://www.cnblogs.com/ykgbk/p/10778276.html
Copyright © 2011-2022 走看看