private void clearPanel() { lockview = true; Panel.Clear(); HomeNavigation.Visibility = Visibility.Hidden; HomeNavigation.Height = 0; }
public void createEmptyGrids() //vytvoří prázdná pole pro padající blok, usazené bloky, následující blok { Grid = new int[columns, rows]; BaseGrid = new int[columns, rows]; TryGrid = new int[columns, rows + 2]; NextGrid = new int[4, 4]; c1.Clear(); //vymaže Canvas pro hrací pole }
protected void GenerateVisualChildren() { if (_visualChildrenGenerated) { return; } if (_visualChildren == null) { _visualChildren = CreateUIElementCollection(this); } else { _visualChildren.Clear(); } foreach (var period in CalendarView.Periods) { _visualChildren.Add(new CalendarViewPeriodPresenter { Period = period, CalendarView = CalendarView, ListView = ListView }); } _visualChildrenGenerated = true; }
/// <summary> /// Clear the content of the annotation viewer /// </summary> public void ClearContent() { HookHidEvents(false); foreach (UIElement uiElement in _uiElements) { Image image = uiElement as Image; if (image != null) { object[] data = (object[])image.Tag; if (data != null) { if (data.Length == 3) { System.IO.MemoryStream ms = data[0] as System.IO.MemoryStream; if (ms != null) { ms.Dispose(); } } } } } _uiElements.Clear(); _inkPresenter.Strokes.Clear(); _changeCount = 0; }
public override void OnApplyTemplate() { if (_closeButton != null) { _closeButton.Click -= OnCloseButtonClick; } base.OnApplyTemplate(); _panel = GetTemplateChild(@"PART_Panel") as Panel; if (_panel != null) { var newChildren = _panel.Children; if (!ReferenceEquals(Children, newChildren)) { var children = Children.OfType <UIElement>().ToList(); Children.Clear(); foreach (var child in children) { newChildren.Add(child); } Children = newChildren; } } _closeButton = GetTemplateChild(@"PART_CloseButton") as Button; if (_closeButton != null) { _closeButton.Click += OnCloseButtonClick; } }
private static void OnAvalibleTagsChanged(FilterControl control, IEnumerable <UserTag> newValue) { ConcurrentDictionary <UserTag, CheckBox> states = control._tagsState; UIElementCollection tagsPanel = control._tagsPanel.Children; states.Clear(); tagsPanel.Clear(); foreach (UserTag userTag in newValue) { SolidColorBrush foreground = new SolidColorBrush(userTag.Foreground); SolidColorBrush background = new SolidColorBrush(userTag.Background); foreground.Freeze(); background.Freeze(); CheckBox checkBox = new CheckBox { Content = userTag.Name, Background = background, IsChecked = null, Margin = new Thickness(3), Tag = userTag, IsThreeState = true, }; states.TryAdd(userTag, checkBox); checkBox.Checked += control.OnTagCheckedChanged; tagsPanel.Add(checkBox); } control.UpdateToggleButtonVisibility(); }
private static void OnAvaliblePropertiesChanged(FilterControl control, IEnumerable <Enum> newValue) { ConcurrentDictionary <Enum, CheckBox> states = control._propertiesState; UIElementCollection propertiesPanel = control._propertiesPanel.Children; states.Clear(); propertiesPanel.Clear(); foreach (Enum value in newValue) { CheckBox checkBox = new CheckBox { Content = value, IsChecked = null, Margin = new Thickness(3), Tag = value, IsThreeState = true, }; states.TryAdd(value, checkBox); checkBox.Checked += control.OnPropertyCheckedChanged; propertiesPanel.Add(checkBox); } control.UpdateToggleButtonVisibility(); }
/// <summary> /// Loads a dashboard layout from a json-formatted file /// </summary> /// <param name="fileName">A filename</param> /// <param name="target">The layout to put content in</param> public static void LoadLayout(string fileName, UIElementCollection target) { List <UIElement> content = null; using (StreamReader sr = new StreamReader(fileName)) { using (JsonReader reader = new JsonTextReader(sr)) { try { content = serializer.Deserialize <List <UIElement> >(reader); } catch { MessageBox.Show("Couldn't load the layout! Either the file contains a control from an unloaded plugin, " + "or was an incorrect file format.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } } } target.Clear(); foreach (UIElement e in content) { target.Add(e); } }
internal void FillNotifications() { _notifications.Clear(); foreach (var notification in AccountManager.CurrentUser.Notifications) { AddNotificationToUi(notification); } }
public static void CopyObjects(DependencyObject source, DependencyObject destination) { if (source is IAddChild) { ContentPropertyAttribute srcCntAttr; if ((TypeDescriptor.GetAttributes(source)[typeof(ContentPropertyAttribute)] is ContentPropertyAttribute)) { srcCntAttr = TypeDescriptor.GetAttributes(source)[typeof(ContentPropertyAttribute)] as ContentPropertyAttribute; if (destination.GetType().GetProperty(srcCntAttr.Name) != null) { System.Reflection.PropertyInfo pi = source.GetType().GetProperty(srcCntAttr.Name); object srcChild = pi.GetValue(source, null); object destChild = pi.GetValue(destination, null); if (srcChild is UIElementCollection && destChild is UIElementCollection) { UIElementCollection srcColl = srcChild as UIElementCollection; UIElementCollection destColl = destChild as UIElementCollection; destColl.Clear(); while (srcColl.Count > 0) { UIElement el = srcColl[0]; srcColl.Remove(el); destColl.Add(el); } } else if (srcChild is DependencyObject && destChild is DependencyObject) { CopyObjects(srcChild as DependencyObject, destChild as DependencyObject); } } } } IList <DependencyProperty> spl = GetSetedProperties(source); IList <DependencyProperty> dpl = GetSetedProperties(destination); foreach (DependencyProperty property in dpl) { try { if (property.ReadOnly != true && property.Name != "Style") { destination.SetValue(property, source.ReadLocalValue(property)); } } catch (Exception) { } } /*foreach (DependencyProperty property in spl) * { * destination.SetValue(property, source.ReadLocalValue(property)); * * }*/ }
protected void GenerateVisualChildren() { if (_visualChildrenGenerated) { return; } if (_visualChildren == null) { _visualChildren = CreateUIElementCollection(null); } else { _visualChildren.Clear(); } RangePanel panel = new RangePanel(); // PERIOD panel.SetBinding(RangePanel.MinimumHeightProperty, new Binding("BeginDate.Ticks") { Source = Period }); panel.SetBinding(RangePanel.MaximumHeightProperty, new Binding("EndDate.Ticks") { Source = Period }); foreach (ListViewItem item in ContentPresenter.ListViewItemVisuals) { if (CalendarView.PeriodContainsItem(item, Period)) { item.SetValue(RangePanel.StartProperty, Convert.ToDouble(((DateTime)item.GetValue(CalendarView.BeginDateProperty)).Ticks)); item.SetValue(RangePanel.FinishProperty, Convert.ToDouble(((DateTime)item.GetValue(CalendarView.EndDateProperty)).Ticks)); item.SetValue(RangePanel.StartDayOfYearProperty, Convert.ToDateTime(item.GetValue(CalendarView.BeginDateProperty)).DayOfYear); item.SetValue(RangePanel.FinishDayOfYearProperty, Convert.ToDateTime(item.GetValue(CalendarView.EndDateProperty)).DayOfYear); panel.Children.Add(item); } } Border border = new Border { BorderBrush = Brushes.Orange, BorderThickness = new Thickness(2.0), CornerRadius = new CornerRadius(10, 10, 10, 10), Child = panel }; _visualChildren.Add(border); _visualChildrenGenerated = true; }
private void CreateColorBlocks() { Children.Clear(); for (int i = 0; i < 256; i++) { var colorBlock = new Border { Tag = i, Margin = new Thickness(-1.0, 0.0, -1.0, 0.0) }; Grid.SetColumn(colorBlock, i); Children.Add(colorBlock); } }
private void ClearChildren() { if (_itemContainerGenerator != null) { ((IItemContainerGenerator)_itemContainerGenerator).RemoveAll(); } if ((_uiElementCollection != null) && (_uiElementCollection.Count > 0)) { _uiElementCollection.Clear(); OnClearChildrenInternal(); } }
/// <summary> /// Clean up after the transition is complete /// </summary> /// <param name="transition"></param> internal void OnTransitionCompleted(Transition transition) { _children.Clear(); _children.Add(_currentHost); _currentHost.Visibility = Visibility.Visible; _previousHost.Visibility = Visibility.Visible; ((ContentPresenter)_previousHost.Child).Content = null; IsTransitioning = false; _activeTransition = null; CoerceValue(TransitionProperty); CoerceValue(ClipToBoundsProperty); CoerceValue(ContentProperty); }
/// <summary> /// Update the images of player hand. /// </summary> /// <param name="player">Player which cards will be drawn.</param> private void UpdateCards(Player player) { UIElementCollection elementCollection = player.IsCroupier ? CroupierDeck.Children : PlayerDeck.Children; elementCollection.Clear(); foreach (Card card in player.Hand) { Image img = new Image { Source = ImageUtilities.ToWpfBitmap((Bitmap)Properties.Resources.ResourceManager.GetObject(card.ToStringShort)), Height = 94, Width = 71, ToolTip = card + "\n" + card.CardScore }; elementCollection.Add(img); } UpdateScores(player); }
protected void GenerateVisualChildren() { if (_visualChildrenGenerated) { return; } if (_visualChildren == null) { _visualChildren = CreateUIElementCollection(this); } else { _visualChildren.Clear(); } foreach (CalendarViewPeriod period in CalendarView.Periods) { Button button = new Button { FontSize = 15, Content = $"{period.BeginDate:ddd, MMM d, yyyy}", HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; if (period.BeginDate.DayOfYear == DateTime.Now.DayOfYear) { button.Background = Brushes.DarkGreen; } _visualChildren.Add(button); } _visualChildrenGenerated = true; }
void Clear() { elements.Clear(); }
/* async void Populate() * { * List<User> UsersToBeDisplayed; * //mt.ricerca_utenti(); * //UsersToBeDisplayed = mt.GetUsers(); * // del_cleaner cleaner = CleanUsersContainer; * * //Dispatcher.Invoke(cleaner,new object[]{UsersContainer.Children }); * /* * foreach(User u in UsersToBeDisplayed) * { * ConnectedUser cu = new ConnectedUser(); * cu.Name = u.getNome(); * cu.Cognome = u.getCognome(); * //cu.UserPicSource = (BitmapImage)u.GetProfilePic(); * UsersContainer.Children.Add(cu); * }*/ // } void CleanUsersContainer(UIElementCollection children) { children.Clear(); }
public void Preview(ViewStatus viewStatus) { UIElementCollection children = pivotTableView.PivotTable.Children; children.Clear(); pivotTableView.PivotTable.ColumnDefinitions.Clear(); pivotTableView.PivotTable.RowDefinitions.Clear(); var groupedRows = viewStatus.GroupedRows; var groupedRowViewModels = viewStatus.GroupedRowViewModels; var selectedColumnViewModels = viewStatus.SelectedColumnViewModels.OrderBy(cvm => (cvm.Type == ColumnType.Categorical ? -1000 : 0) + cvm.Order); if (viewStatus.IsN) { Int32 rowN = groupedRows.Count + 1, // 테이블 전체 로우의 개수 columnN = 2; Int32 i, index, j; // 개수만큼 추가 컬럼 및 로우 정의 추가. 이중선 말고는 별 특별한 점 없음. for (i = 0; i < rowN; ++i) { RowDefinition rowDefinition = new RowDefinition(); rowDefinition.Height = GridLength.Auto; pivotTableView.PivotTable.RowDefinitions.Add(rowDefinition); } for (i = 0; i < columnN; ++i) { ColumnDefinition columnDefinition = new ColumnDefinition(); pivotTableView.PivotTable.ColumnDefinitions.Add(columnDefinition); } // 가로 이름 넣기 (인덱스 열 포함) index = 0; foreach (ColumnViewModel columnViewModel in selectedColumnViewModels) { Border border = new Border() { Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style }; TextBlock textBlock = new TextBlock() { Text = columnViewModel.FormatPivotTableHeaderName(viewStatus), Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style }; border.Child = textBlock; children.Add(border); Grid.SetRow(border, 0); Grid.SetColumn(border, index++); } { Border border = new Border() { Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style }; TextBlock textBlock = new TextBlock() { Text = String.Format( Const.Loader.GetString("CountColumnName").Replace("|", ""), selectedColumnViewModels.First().Name ), Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style }; border.Child = textBlock; children.Add(border); Grid.SetRow(border, 0); Grid.SetColumn(border, index++); } // 데이터 넣기 i = 0; foreach (GroupedRows grs in groupedRows.Take(MaximumRowNumber)) { j = 0; foreach (ColumnViewModel columnViewModel in selectedColumnViewModels) { Bin bin = grs.Keys[columnViewModel] as Bin; String content = bin.ToString(); Border border = GetNewBorder(content); (border.Child as TextBlock).Foreground = ViewStatus.Category10FirstSolidColorBrush; children.Add(border); Grid.SetRow(border, 1 + i); Grid.SetColumn(border, j++); } { Border border = GetNewBorder(grs.Rows.Count); children.Add(border); Grid.SetRow(border, 1 + i); Grid.SetColumn(border, j++); } i++; } } else { // TODO Cx 의 경우 Count 컬럼 추가하고 값 넣어야함 Int32 rowN = groupedRows.Count + 1, // 테이블 전체 로우의 개수 columnN = selectedColumnViewModels.Count() /* + 1 + 1*/; // 테이블 전체 컬럼의 개수 Boolean isOnlyCn = viewStatus.IsOnlyCn; Int32 i, index, j; if (isOnlyCn) { columnN++; } // 개수만큼 추가 컬럼 및 로우 정의 추가. 이중선 말고는 별 특별한 점 없음. for (i = 0; i < rowN; ++i) { RowDefinition rowDefinition = new RowDefinition(); rowDefinition.Height = GridLength.Auto; pivotTableView.PivotTable.RowDefinitions.Add(rowDefinition); } for (i = 0; i < columnN; ++i) { ColumnDefinition columnDefinition = new ColumnDefinition(); pivotTableView.PivotTable.ColumnDefinitions.Add(columnDefinition); } // 가로 이름 넣기 (인덱스 열 포함) index = 0; foreach (ColumnViewModel columnViewModel in selectedColumnViewModels) { Border border = new Border() { Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style }; TextBlock textBlock = new TextBlock() { Text = columnViewModel.FormatPivotTableHeaderName(viewStatus), Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style }; border.Child = textBlock; children.Add(border); Grid.SetRow(border, 0); Grid.SetColumn(border, index++); } if (isOnlyCn) { Border border = new Border() { Style = pivotTableView.Resources["ColumnHeaderBorderStyle"] as Style }; TextBlock textBlock = new TextBlock() { Text = Const.Loader.GetString("Count"), Style = pivotTableView.Resources["ColumnHeaderValueTextStyle"] as Style }; border.Child = textBlock; children.Add(border); Grid.SetRow(border, 0); Grid.SetColumn(border, columnN - 1); } // 데이터 넣기 i = 0; ColumnViewModel lastCategorical = viewStatus.LastCategorical; foreach (RowViewModel rowViewModel in groupedRowViewModels.Take(MaximumRowNumber)) { j = 0; foreach (ColumnViewModel columnViewModel in selectedColumnViewModels) { Border border = GetNewBorder(rowViewModel.Cells[columnViewModel.Index].Content); children.Add(border); if (columnViewModel == lastCategorical) { (border.Child as TextBlock).Foreground = new SolidColorBrush(rowViewModel.Color); } Grid.SetRow(border, 1 + i); Grid.SetColumn(border, j++); } if (isOnlyCn) { Border border = GetNewBorder(rowViewModel.Rows.Count().ToString()); children.Add(border); Grid.SetRow(border, 1 + i); Grid.SetColumn(border, columnN - 1); } i++; } } }
protected override Size MeasureOverride(Size availableSize) { Panel panel = this.GroupLevelIndicatorPaneHost; if (panel == null) { return(base.MeasureOverride(availableSize)); } DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); if (dataGridContext != null) { ObservableCollection <GroupDescription> groupDescriptions = DataGridContext.GetGroupDescriptionsHelper(dataGridContext.Items); int leafGroupLevel = GroupLevelIndicatorPane.GetGroupLevel(this); // If Indented is true (default), we use the total groupDescriptions.Count for this DataGridContext int correctedGroupLevel = (this.Indented == true) ? groupDescriptions.Count : leafGroupLevel; // Ensure that the GroupLevel retrieved does not exceeds the number of group descriptions for the DataGridContext correctedGroupLevel = Math.Min(correctedGroupLevel, groupDescriptions.Count); // Then finally, if the GroupLevel is -1, then indent at maximum. if (correctedGroupLevel == -1) { correctedGroupLevel = groupDescriptions.Count; } if ((correctedGroupLevel > 0) && (this.AreGroupsFlattened)) { correctedGroupLevel = (this.Indented) ? 1 : 0; } UIElementCollection children = panel.Children; int childrenCount = children.Count; // If we need to add/remove GroupLevelIndicators from the panel if (correctedGroupLevel != childrenCount) { // When grouping change, we take for granted that the group deepness will change, // so we initialize DataContext of the margin only in there. // Clear all the panel's children! children.Clear(); // Create 1 group margin content presenter for each group level for (int i = correctedGroupLevel - 1; i >= 0; i--) { GroupLevelIndicator groupMargin = new GroupLevelIndicator(); groupMargin.DataContext = dataGridContext.GroupLevelDescriptions[i]; children.Insert(0, new GroupLevelIndicator()); } childrenCount = correctedGroupLevel; this.SetCurrentIndicatorCount(childrenCount); } object item = dataGridContext.GetItemFromContainer(this); for (int i = 0; i < childrenCount; i++) { GroupLevelIndicator groupMargin = children[i] as GroupLevelIndicator; CollectionViewGroup groupForIndicator = GroupLevelIndicatorPane.GetCollectionViewGroupHelper( dataGridContext, groupDescriptions, item, i); GroupConfiguration groupLevelConfig = GroupConfiguration.GetGroupConfiguration( dataGridContext, groupDescriptions, dataGridContext.GroupConfigurationSelector, i, groupForIndicator); if (groupLevelConfig != null) { Binding groupLevelIndicatorStyleBinding = BindingOperations.GetBinding(groupMargin, GroupLevelIndicator.StyleProperty); if ((groupLevelIndicatorStyleBinding == null) || (groupLevelIndicatorStyleBinding.Source != groupLevelConfig)) { groupLevelIndicatorStyleBinding = new Binding("GroupLevelIndicatorStyle"); groupLevelIndicatorStyleBinding.Source = groupLevelConfig; groupMargin.SetBinding(GroupLevelIndicator.StyleProperty, groupLevelIndicatorStyleBinding); } } else { groupMargin.ClearValue(GroupLevelIndicator.StyleProperty); } // If the ShowIndicators property is False or there is already leafGroupLevel GroupLevelIndicators in the panel, // the current newGroupMargin must be hidden. if ((!GroupLevelIndicatorPane.GetShowIndicators(this)) || ((i >= leafGroupLevel) && (leafGroupLevel != -1))) { groupMargin.Visibility = Visibility.Hidden; } else { groupMargin.Visibility = Visibility.Visible; } } } return(base.MeasureOverride(availableSize)); }
private void UpdateMapMesh() { int n = border.GetNumberOfBorderLines(); Brush map_brush = new SolidColorBrush(Colors.Black); UIElementCollection canvas_children = canvas_projection_mesh.Children; canvas_children.Clear(); #if true for (int i = 0; i < n; i++) { double StrokeThickness = border.GetBorderThickness(i) * 0.5; PointCollection points = border.GetAsSphericalCoord(i); PointCollection pointDeg = new PointCollection(points.Count); foreach (Point element in points) { double azimuth, elevation; SphToMapTransform(element.X, element.Y, out azimuth, out elevation); pointDeg.Add(new Point() { X = azimuth, Y = elevation }); } int num_begin = 0; int num_end = pointDeg.Count; for (int j = 0; j < num_end; j++) { if ((j == (num_end - 1)) || (Math.Abs(pointDeg[j].X - pointDeg[j + 1].X) > 100.0) || (Math.Abs(pointDeg[j].Y - pointDeg[j + 1].Y) > 90.0)) { int length = j - num_begin + 1; if (length == num_end) { Polyline segment = new Polyline(); segment.Points = pointDeg; segment.Stroke = map_brush; segment.StrokeThickness = StrokeThickness; canvas_children.Add(segment); } else if (length >= 2) { PointCollection pointDegPart = new PointCollection(length); for (int k = num_begin; k <= j; k++) { pointDegPart.Add(pointDeg[k]); } Polyline segment = new Polyline(); segment.Points = pointDegPart; segment.Stroke = map_brush; segment.StrokeThickness = StrokeThickness; canvas_children.Add(segment); } num_begin = j + 1; } } } #else for (int i = 0; i < n; i++) { double StrokeThickness = border.GetBorderThickness(i) * 0.5; PointCollection points = border.GetAsSphericalCoord(i); PointCollection pointDeg = new PointCollection(points.Count); foreach (Point element in points) { double azimuth, elevation; SphToMapTransform(element.X, element.Y, out azimuth, out elevation); pointDeg.Add(new Point() { X = azimuth, Y = elevation }); } int discontinuous_idx = -1; int last_num = pointDeg.Count; for (int j = 0; j < last_num - 1; j++) { if ((Math.Abs(pointDeg[j].X - pointDeg[j + 1].X) > 100.0) || (Math.Abs(pointDeg[j].Y - pointDeg[j + 1].Y) > 90.0)) { discontinuous_idx = j; break; } } if (discontinuous_idx < 0) { Polyline segment = new Polyline(); segment.Points = pointDeg; segment.Stroke = map_brush; segment.StrokeThickness = StrokeThickness; canvas_children.Add(segment); } else { PointCollection pointDeg1 = new PointCollection(discontinuous_idx + 1); PointCollection pointDeg2 = new PointCollection(pointDeg.Count - (discontinuous_idx + 1)); for (int j = 0; j <= discontinuous_idx; j++) { pointDeg1.Add(pointDeg[j]); } for (int j = discontinuous_idx + 1; j < last_num; j++) { pointDeg2.Add(pointDeg[j]); } Polyline segment = new Polyline(); segment.Points = pointDeg1; segment.Stroke = map_brush; segment.StrokeThickness = StrokeThickness; canvas_children.Add(segment); segment = new Polyline(); segment.Points = pointDeg2; segment.Stroke = map_brush; segment.StrokeThickness = StrokeThickness; canvas_children.Add(segment); } } #endif }
public void Clear() { _items.Clear(); }
/// <inheritdoc /> public void Clear() => _collection.Clear();
public void Route() { container.Clear(); container.Add(new StartView(new StartViewModel(new OrderModel()))); }