private void SetPanelStyle() { if (Standard != null) { VisualStyle style = Standard.PanelStyle; if (style != null && mBorderPanel != null) { if (style.Width != 0) { mBorderPanel.Width = style.Width; } else { mBorderPanel.ClearValue(WidthProperty); } if (style.Height != 0) { mBorderPanel.Height = style.Height; } else { mBorderPanel.ClearValue(HeightProperty); } mBorderPanel.Background = new SolidColorBrush(style.BackColor); } } }
private void SetPanelStyle() { if (ScoreItem != null) { VisualStyle style = ScoreItem.TitleStyle; if (style != null && mBorderPanel != null) { if (style.Width > 0) { mBorderPanel.Width = style.Width; } else { mBorderPanel.ClearValue(WidthProperty); } if (style.Height > 0) { mBorderPanel.Height = style.Height; } else { mBorderPanel.ClearValue(HeightProperty); } mBorderPanel.Background = new SolidColorBrush(style.BackColor); } } }
private static void RecycleAdditionalVisual(Border visual) { visual.ClearValue(Border.StyleProperty); visual.ClearValue(Canvas.ZIndexProperty); visual.Visibility = Visibility.Collapsed; visual.Tag = null; }
private void RecyclePrimaryVisual(Border visual) { this.recycledContainers.Enqueue(visual); visual.ClearValue(Border.StyleProperty); visual.ClearValue(Canvas.ZIndexProperty); // NOTE: We are additionally clearing these properties for two reasons: // gridline styling and the "magic" compensation of the stroke thickness for cell decorations. visual.ClearValue(Border.BorderBrushProperty); visual.ClearValue(Border.BorderThicknessProperty); }
void UpdatePadding(MetroWindow window) { Debug.Assert(window != null); var state = window.IsFullScreen ? WindowState.Maximized : window.WindowState; switch (state) { default: case WindowState.Normal: border.ClearValue(Border.PaddingProperty); border.BorderThickness = oldThickness; break; case WindowState.Minimized: case WindowState.Maximized: const int magic = 2; border.Padding = new Thickness( SystemParameters.BorderWidth + border.BorderThickness.Left + magic, SystemParameters.BorderWidth + border.BorderThickness.Top + magic, SystemParameters.BorderWidth + border.BorderThickness.Right + magic, SystemParameters.BorderWidth + border.BorderThickness.Bottom + magic); border.BorderThickness = new Thickness(0); break; } }
void UpdatePadding(MetroWindow window) { Debug.Assert(window != null); var state = window.IsFullScreen ? WindowState.Maximized : window.WindowState; switch (state) { default: case WindowState.Normal: border.ClearValue(Border.PaddingProperty); border.BorderThickness = oldThickness; break; case WindowState.Minimized: case WindowState.Maximized: double magicx, magicy; magicx = magicy = 10;//TODO: Figure out how this value is calculated (it's not ResizeBorderThickness.Left/Top) double deltax = magicx - SystemParameters.ResizeFrameVerticalBorderWidth; double deltay = magicy - SystemParameters.ResizeFrameHorizontalBorderHeight; Debug.Assert(deltax >= 0 && deltay >= 0); if (deltax < 0) deltax = 0; if (deltay < 0) deltay = 0; border.Padding = new Thickness( SystemParameters.BorderWidth + border.BorderThickness.Left + deltax, SystemParameters.BorderWidth + border.BorderThickness.Top + deltay, SystemParameters.BorderWidth + border.BorderThickness.Right + deltax, SystemParameters.BorderWidth + border.BorderThickness.Bottom + deltay); border.BorderThickness = new Thickness(0); break; } }
private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Border control = (Border)sender; control.ClearValue(Border.PaddingProperty); ProcessAction((FrameworkElement)sender); }
private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { void SetRichTextBlockContent(RichTextBlock richTextBlock, Block word) { if (richTextBlock.Blocks.Count == 0) { richTextBlock.Blocks.Add(word); } else { if (richTextBlock.Blocks[0] == word) { // clearing Blocks helps working around a bug with RichTextBlock when reusing Block elements richTextBlock.Blocks.Clear(); return; } richTextBlock.Blocks[0] = word; } } DictionaryEntryViewModel viewModel = (DictionaryEntryViewModel)args.Item; Grid templateRoot = (Grid)args.ItemContainer.ContentTemplateRoot; Grid grid = (Grid)templateRoot.Children[2]; RichTextBlock word1RichTextBlock = (RichTextBlock)grid.Children[0]; RichTextBlock word2RichTextBlock = (RichTextBlock)templateRoot.Children[3]; SetRichTextBlockContent(word1RichTextBlock, viewModel.Word1); SetRichTextBlockContent(word2RichTextBlock, viewModel.Word2); Border border = (Border)templateRoot.Children[0]; if (args.ItemIndex % 2 == 0) { border.ClearValue(Border.BackgroundProperty); } else { border.Background = altBackgroundThemeBrush; } }
public void Toggle_Style() { SUT.Style = new Windows.UI.Xaml.Style(); SUT.ClearValue(Border.StyleProperty); }
private void restore(object sender, MouseEventArgs e) { Border temp = (Border)sender; temp.ClearValue(BackgroundProperty); }
private void ContextMenu_Closed(object sender, RoutedEventArgs e) { buttonBorder.ClearValue(Border.BackgroundProperty); buttonBorder.ClearValue(Border.BorderBrushProperty); buttonBorder.ContextMenu.Closed -= contextMenuClosedHandler; }