realized items count only visible when debugging

master
Jonas Arnold 3 years ago
parent 7061568cda
commit 0ed1e65f94
  1. 12
      MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.cs
  2. 3
      MultiTerm.Wpf.CustomControl/MultiFormatDataView/MultiFormatDataView.xaml

@ -1,6 +1,5 @@
using MultiTerm.Core.ViewModel; using MultiTerm.Core.ViewModel;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows; using System.Windows;
@ -10,6 +9,7 @@ using System.Linq;
using System.Collections.Specialized; using System.Collections.Specialized;
using MultiTerm.Protocols.Model; using MultiTerm.Protocols.Model;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics;
namespace MultiTerm.Wpf.CustomControl; namespace MultiTerm.Wpf.CustomControl;
@ -19,6 +19,7 @@ public class MultiFormatDataView : Control
private const string itemsControlTemplateName = "PART_ItemsControl"; private const string itemsControlTemplateName = "PART_ItemsControl";
private const string buttonClearTemplateName = "PART_ButtonClear"; private const string buttonClearTemplateName = "PART_ButtonClear";
private const string textBoxCharOnlyViewTemplateName = "PART_CharOnlyTextBox"; private const string textBoxCharOnlyViewTemplateName = "PART_CharOnlyTextBox";
private const string realizedItemsCountTemplateName = "PART_RealizedItemsCountDisplay";
private ListBox? itemsControl; private ListBox? itemsControl;
private TextBox? tbCharOnlyView; private TextBox? tbCharOnlyView;
private ICollectionView? collectionView; private ICollectionView? collectionView;
@ -139,6 +140,15 @@ public class MultiFormatDataView : Control
{ {
button.Click += OnClearButtonClicked; ; button.Click += OnClearButtonClicked; ;
} }
// hide realized items count when not debugging
if (Debugger.IsAttached == false)
{
if(GetTemplateChild(realizedItemsCountTemplateName) is UIElement realizedItemsUiElement)
{
realizedItemsUiElement.Visibility = Visibility.Hidden;
}
}
} }
private static void OnDataSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnDataSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

@ -233,7 +233,8 @@
<!-- Realized Items Display (on top of ListView because if comes later in the list) --> <!-- Realized Items Display (on top of ListView because if comes later in the list) -->
<StackPanel Grid.Column="0" Grid.Row="0" Margin="5 5 25 5" Grid.ZIndex="1" Background="Azure" <StackPanel Grid.Column="0" Grid.Row="0" Margin="5 5 25 5" Grid.ZIndex="1" Background="Azure"
Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right"> Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right"
x:Name="PART_RealizedItemsCountDisplay">
<Label Content="Realized Items: " HorizontalAlignment="Left" Margin="0 0 0 0"/> <Label Content="Realized Items: " HorizontalAlignment="Left" Margin="0 0 0 0"/>
<Label Width="40" HorizontalContentAlignment="Right" Content="{TemplateBinding RealizedItemsCount}"/> <Label Width="40" HorizontalContentAlignment="Right" Content="{TemplateBinding RealizedItemsCount}"/>
</StackPanel> </StackPanel>

Loading…
Cancel
Save