zoukankan      html  css  js  c++  java
  • win8 app GridView点击子项布局变更

    要触发点击必须设置IsItemClickEnabled="True"

    要变更布局代码如下:

     private void gridView_ItemClick_1(object sender, ItemClickEventArgs e)
            {
                ColorModel model = (e.ClickedItem as ColorModel);//自定义的类
                model.ColSpan = 2;//占的格数
                model.RowSpan = 2;//占的格数
                (VisualTreeHelper.GetChild(((VisualTreeHelper.GetChild(gridView, 0) as Border).Child as ScrollViewer).Content as FrameworkElement, 1) as VariableSizedWrapGrid).Children[gridView.Items.IndexOf(e.ClickedItem)].SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, model.ColSpan);
                (VisualTreeHelper.GetChild(((VisualTreeHelper.GetChild(gridView, 0) as Border).Child as ScrollViewer).Content as FrameworkElement, 1) as VariableSizedWrapGrid).Children[gridView.Items.IndexOf(e.ClickedItem)].SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, model.RowSpan);
                (VisualTreeHelper.GetChild(((VisualTreeHelper.GetChild(gridView, 0) as Border).Child as ScrollViewer).Content as FrameworkElement, 1) as VariableSizedWrapGrid).InvalidateArrange();//重新布局
                (VisualTreeHelper.GetChild(((VisualTreeHelper.GetChild(gridView, 0) as Border).Child as ScrollViewer).Content as FrameworkElement, 1) as VariableSizedWrapGrid).InvalidateMeasure();//重新计算

    }

  • 相关阅读:
    mysql基础(三)
    mysql基础(二)
    Mysql基础(一)
    Less32-Less-33
    Less-27
    Less-26
    Less-25
    Less-23
    Less18-Less19
    Less13-Less-14
  • 原文地址:https://www.cnblogs.com/wangjinming/p/4594876.html
Copyright © 2011-2022 走看看