• 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();//重新计算

    }

  • 相关阅读:
    第18章 检测点模型
    第17章 发现过拟合和欠拟合
    第16章 学习速率调度器
    第15章 MiniVGGNet:更深的CNNs
    第14章 LeNet:识别手写数字
    第13章保存和加载你的模型
    第12章 训练你的第一个CNN
    Vue.js
    python3第一天
    R+JAVA 中文乱码问题
  • 原文地址:https://www.cnblogs.com/wangjinming/p/4594876.html
Copyright © 2020-2023  润新知