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


C# Grid.FindName方法代码示例

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


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

示例1: UpdateTileImagePrivate

        private static async Task UpdateTileImagePrivate(Grid tileControl, SecondaryTile secondaryTile)
        {
            Action<string, string> assignText = (name, text) => ((TextBlock)tileControl.FindName(name)).Text = text;
            Action<string> hide = (name) => ((TextBlock)tileControl.FindName(name)).Visibility = Visibility.Collapsed;

            assignText("Timestamp", "Last update " + DateTime.Now.ToString("hh:mm:ss"));

            Timetable timetable = null;

            try
            {
                timetable = Timetable.ParseXml(await FileIO.ReadTextAsync(await
                    (await ApplicationData.Current.LocalFolder.GetFolderAsync("Timetables")).GetFileAsync(secondaryTile.Arguments)),
                    secondaryTile.Arguments, "");

                var day = timetable.GetListedLessons(DateTime.Now, DateTime.Now.AddDays(7), ConvertHelpers.IsOddWeek(DateTime.Now))
                    .First(p => p.Value.Any(q => q.Value.Subject != Subject.None));

                var lessonList = day.Value.Where(q => q.Value.Subject != Subject.None).Take(4).Select(p => new LessonData()
                {
                    LessonTime = string.Format(Strings.LessonTimeMultiLineFormat, p.Key.Start, p.Key.End),
                    Subject = p.Value.Subject.Name,
                    Room = p.Value.Room
                }).ToList();

                if (day.Key.Date != DateTime.Today)
                {
                    lessonList.Insert(0, new LessonData() { LessonTime = day.Key.Date.ToString("dddd") });
                    while (lessonList.Count > 4)
                        lessonList.RemoveAt(4);
                }

                ((ItemsControl)tileControl.FindName("LessonsControl")).ItemsSource = lessonList;

                var imageFileName = secondaryTile.Arguments + ".png";
                var wideImageFileName = secondaryTile.Arguments + ".wide.png";

                await RenderTile(tileControl, wideImageFileName, 310, 150);

                tileControl.Width = tileControl.Height;

                await RenderTile(tileControl, imageFileName, 150, 150);

                secondaryTile.VisualElements.Square150x150Logo = new Uri("ms-appdata:///local/" + imageFileName);
                secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appdata:///local/" + wideImageFileName);

                secondaryTile.DisplayName = timetable.Name;
            }
            catch
            {
                secondaryTile.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/Logo.scale-240.png");
                secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/WideLogo.scale-240.png");

                return;
            }

        }
开发者ID:JulianMH,项目名称:ModernTimetable,代码行数:57,代码来源:AppTileUpdater.cs

示例2: PlaybackControl

 public PlaybackControl(Grid grid)
 {
     PlaybackControlGrid = grid;
     PlayPauseButton = PlaybackControlGrid.FindName("PlayPauseButtonOnLeft") as AppBarButton;
     ShuffleButton = PlaybackControlGrid.FindName("ShuffleButton") as AppBarButton;
     AlbumArtwork = PlaybackControlGrid.FindName("PlayBackImage") as Image;
     TimeRemainingBlock = PlaybackControlGrid.FindName("TimeRemainingBlock") as TextBlock;
     TimePastBlock = PlaybackControlGrid.FindName("TimeElapsedBlock") as TextBlock;
     ProgressSlider = PlaybackControlGrid.FindName("ProgressSlider") as Slider;
 }
开发者ID:aurora-lzzp,项目名称:com.aurora.aumusic,代码行数:10,代码来源:PlaybackControl.cs

示例3: loadFeedGrid

        /// <summary>
        /// 加载Grid中的Feed源
        /// </summary>
        /// <returns></returns>
        private async Task loadFeedGrid(Grid feedGrid) {
            ProgressRing progRing = (ProgressRing)feedGrid.FindName("prog");
            TextBlock subTitle = (TextBlock)feedGrid.FindName("subTitle");
            TextBlock description = (TextBlock)feedGrid.FindName("description");
            TextBlock newNumText = (TextBlock)feedGrid.FindName("newNum");

            progRing.Visibility = Visibility.Visible;
            subTitle.Visibility = Visibility.Collapsed;
            description.Visibility = Visibility.Collapsed;

            var feed = (Feed)feedGrid.DataContext;
            await FeedDataSource.getInstance().loadFeedAsync(feed);

            Binding b = new Binding();
            b.Mode = BindingMode.TwoWay;
            b.Source = feed.Items.Count((i) => !i.IsRead);
            newNumText.SetBinding(TextBlock.TextProperty, b);

            progRing.Visibility = Visibility.Collapsed;
            subTitle.Visibility = Visibility.Visible;
            if (ApplicationView.Value != ApplicationViewState.Snapped) {
                description.Visibility = Visibility.Visible;
            }
        }
开发者ID:edwardpan,项目名称:MarkRSSReader,代码行数:28,代码来源:AllFeedsPage.xaml.cs

示例4: Item_Tapped

        private async void Item_Tapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            item = sender as Grid;
            ep = item.DataContext as Episode;

            

            Image ima = item.FindName("ima") as Image;
            if (ima.Opacity > 0.5)
            {
                if (!ep.Aired)
                {
                    Helper.message("This episode hasn't aired yet. You cannot mark it as watched", "EPISODE NOT AIRED");
                    return;
                }

                if (await api.hasInternet())
                {
                    await ep.markAsWatched();
                    await Memory.storeMostRecentQueueEpisode(q);
                }
                else
                {
                    Memory.addCommand(new Command() { episode = ep, watched = true });
                }

                DoubleAnimation ani = new DoubleAnimation();
                Storyboard.SetTarget(ani, ima);

                Storyboard board = new Storyboard();
                board.Completed += board_Completed;
                Storyboard.SetTargetProperty(ani, "Opacity");
                ani.To = 0.2;
                ep.Opacity = 0.2;
                board.Duration = new Duration(TimeSpan.FromSeconds(1));
                board.Children.Add(ani);

                ep.Seen = true;

                board.Begin();

                ep.OnPropertyChanged("redo");
            }
            else
            {
                item = sender as Grid;
                ep = item.DataContext as Episode;

                DoubleAnimation ani = new DoubleAnimation();
                Storyboard.SetTarget(ani, ima);

                Storyboard board = new Storyboard();
                Storyboard.SetTargetProperty(ani, "Opacity");
                ani.To = 0.9;
                board.Duration = new Duration(TimeSpan.FromSeconds(1));
                board.Children.Add(ani);

                board.Begin();

                ep.Seen = false;

                ep.OnPropertyChanged("redo");
                ep.OnPropertyChanged("Opacity");

                if (await api.hasInternet())
                {
                    await ep.markNotAsWatched();
                }
                else
                {
                    Command com = new Command();
                    com.episode = ep;
                    com.watched = false;

                    Memory.addCommand(com);
                }


            }

            //Update the last new queue item
            await Memory.storeMostRecentQueueEpisode((queue.ItemsSource as Queue));
        }
开发者ID:newnottakenname,项目名称:FollowshowsWP,代码行数:83,代码来源:MainPage.xaml.cs

示例5: RefreshCruptedImageItem

		private async Task RefreshCruptedImageItem(Grid iv)
		{
			var imageContent = iv.FindName("ImageContent") as Image;
			var lvm = imageContent.DataContext as LineViewModel;
			if (lvm == null) return;

			var bitmap = imageContent.Source as BitmapImage;
			if (bitmap == null) return;

			var uri = bitmap.UriSource.AbsoluteUri;
			if (uri.StartsWith("ms-appdata"))
			{

				var textContent = iv.FindName("TextContent") as TextBlock;
				var commentIndicator = iv.FindName("CommentIndicator") as Rectangle;
				var progressIndicator = iv.FindName("ProgressBar") as ProgressBar;
				var imagePlaceholder = iv.FindName("ImagePlaceHolder") as Windows.UI.Xaml.Shapes.Path;

				var remoteUri = lvm.Content;

				textContent.Text = ImageLoadingTextPlaceholder;
				imagePlaceholder.Visibility = Windows.UI.Xaml.Visibility.Visible;
				imagePlaceholder.Opacity = 1;
				imageContent.Visibility = Windows.UI.Xaml.Visibility.Visible;
				textContent.TextAlignment = TextAlignment.Center;
				textContent.Opacity = 1;
				imageContent.Opacity = 0;
				progressIndicator.Opacity = 1;

				imageContent.ImageOpened -= imageContent_ImageOpened;
				bitmap.DownloadProgress -= Image_DownloadProgress;

				bitmap.UriSource = new Uri(remoteUri);
				bitmap.DownloadProgress += Image_DownloadProgress;
				imageContent.ImageOpened += imageContent_ImageOpened;

				await CachedClient.DeleteIllustationAsync(remoteUri);
			} // else is Network Issue
		}
开发者ID:fuchu,项目名称:LightNovelClientWindows,代码行数:39,代码来源:ReadingPage.xaml.cs

示例6: LoadItemIllustation

		private void LoadItemIllustation(Grid iv, LineViewModel line)
		{
			var bitMap = new BitmapImage(line.ImageUri);
			var imageContent = iv.FindName("ImageContent") as Image;
			imageContent.DataContext = line;
			var imagePlaceHolder = iv.FindName("ImagePlaceHolder") as Windows.UI.Xaml.Shapes.Path;
			var progressIndicator = iv.FindName("ProgressBar") as ProgressBar;

			bitMap.SetValue(BitmapLoadingIndicatorProperty, progressIndicator);
			bitMap.DownloadProgress += Image_DownloadProgress;
			imageContent.ImageOpened += imageContent_ImageOpened;
			imageContent.ImageFailed += ImageContent_Failed;
			imageContent.Source = bitMap;
		}
开发者ID:fuchu,项目名称:LightNovelClientWindows,代码行数:14,代码来源:ReadingPage.xaml.cs

示例7: FindOrCreateGridForLayout

        private Grid FindOrCreateGridForLayout(Grid parent, string loc)
        {
            Tuple<int, int> quad;

            int row = 0;
            int col = 0;
            var gridName = (parent == baseImpl.RootUI ? kGridName : parent.Name) + "_" + loc;
            var pctl = (Grid)parent.FindName(gridName);
            if (pctl == null)
            {
                quad = TranslateQLoc(loc);
                row = quad.Item1;
                col = quad.Item2;

                var grid = new Grid();
                grid.Name = gridName;
                grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                grid.VerticalAlignment = VerticalAlignment.Stretch;
                EnsureGrid(grid);
                grid.SetValue(Grid.RowProperty, row);
                grid.SetValue(Grid.ColumnProperty, col);

                parent.Children.Add(grid);
                pctl = grid;
            }
            return pctl;
        }
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:27,代码来源:SimpleRuntime-Setup.cs


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