当前位置: 首页>>代码示例>>C#>>正文


C# ContentControl.SetValue方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.ContentControl.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ContentControl.SetValue方法的具体用法?C# ContentControl.SetValue怎么用?C# ContentControl.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.ContentControl的用法示例。


在下文中一共展示了ContentControl.SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SquareOfSquares

        public SquareOfSquares()
        {
            this.InitializeComponent();

            Root.RowDefinitions.Clear();
            Root.RowDefinitions.Clear();

            for (int i = 0; i < 112; i++)
            {
                Root.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
                Root.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
            }

            foreach (InnerSquare square in GetSquares())
            {
                var ctl = new ContentControl();
                ctl.SetValue(Grid.RowProperty, square.Position.Y);
                ctl.SetValue(Grid.ColumnProperty, square.Position.X);
                ctl.SetValue(Grid.ColumnSpanProperty, square.Side);
                ctl.SetValue(Grid.RowSpanProperty, square.Side);
                Root.Children.Add(ctl);
                Squares.Add(ctl);
            }
        }
开发者ID:XamlBrewer,项目名称:UWP-Composition-Radial-Gauge,代码行数:24,代码来源:SquareOfSquares.xaml.cs

示例2: RebuildTable

 private void RebuildTable()
 {
     Children.Clear();
     if (ItemsSource == null || !(ItemsSource is IEnumerable))
         return;
     var list = (ItemsSource as IEnumerable).OfType<object>().ToList();
     int count = list.Count;
     int rows = currentRowCount;
     int cols = currentColumnCount;
     int itemSpace = rows * cols;
     bool hasLiveTile = false;
     if (count > itemSpace)
     {
         LiveTile tile = new LiveTile()
         {
             ItemsSource = ItemsSource,
             ItemTemplate = LiveTileItemTemplate,
             Margin = new Thickness(0, 0, 20, 20)
         };
         tile.SetValue(Callisto.Effects.Tilt.IsTiltEnabledProperty, true);
         Children.Add(tile);
         hasLiveTile = true;
         tile.Tapped += livetile_Tapped;
     }
     int i = 0;
     for (int c = 0; c < cols; c++)
     {
         for (int r = 0; r < rows; r++)
         {
             if (i >= list.Count)
                 break;
             if (hasLiveTile && c < 2 && r < 2)
                 continue;
             ContentControl ctrl = new ContentControl()
             {
                 Content = list[i++],
                 ContentTemplate = ItemTemplate,
                 Margin = new Thickness(0, 0, 20, 20),
                 HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                 VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                 HorizontalContentAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                 VerticalContentAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch
             };
             //ctrl.Transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
             //ctrl.Transitions.Add(new Windows.UI.Xaml.Media.Animation.AddDeleteThemeTransition());
             //ctrl.Transitions.Add(new Windows.UI.Xaml.Media.Animation.EntranceThemeTransition());
             ctrl.SetValue(Callisto.Effects.Tilt.IsTiltEnabledProperty, true);
             if (r == rows - 1 && c == Math.Min(cols, MaxColumnCount) - 1 &&
                 count > rows * cols) // last item
             {
                 ctrl.ContentTemplate = MoreTemplate;
                 ctrl.Tapped += moreTile_Tapped;
             }
             else
             {
                 ctrl.Tapped += ctrl_Tapped;
             }
             Children.Add(ctrl);
         }
     }
 }
开发者ID:smarteatsmarties,项目名称:arcgis-portalviewer-dotnet,代码行数:61,代码来源:GalleryPreviewControl.cs


注:本文中的Windows.UI.Xaml.Controls.ContentControl.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。