init
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using DTS.Common.Classes;
|
||||
using DTS.Common.Interface.Sensors.SensorsList;
|
||||
using DTS.Common.Interface.TestSetups.TestSetupsList;
|
||||
namespace DTS.Common.Behaviors
|
||||
{
|
||||
public class MultiSelectionBehavior : Behavior<ListBox>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
if (SelectedItems != null)
|
||||
{
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
foreach (var item in SelectedItems)
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IList SelectedItems
|
||||
{
|
||||
get => (IList)GetValue(SelectedItemsProperty);
|
||||
set => SetValue(SelectedItemsProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedItemsProperty =
|
||||
DependencyProperty.Register("SelectedItems", typeof(IList), typeof(MultiSelectionBehavior), new UIPropertyMetadata(null, SelectedItemsChanged));
|
||||
|
||||
private static void SelectedItemsChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var behavior = o as MultiSelectionBehavior;
|
||||
if (behavior == null)
|
||||
return;
|
||||
|
||||
|
||||
if (e.OldValue is INotifyCollectionChanged oldValue)
|
||||
{
|
||||
oldValue.CollectionChanged -= behavior.SourceCollectionChanged;
|
||||
behavior.AssociatedObject.SelectionChanged -= behavior.ListBoxSelectionChanged;
|
||||
}
|
||||
if (e.NewValue is INotifyCollectionChanged newValue)
|
||||
{
|
||||
behavior.AssociatedObject.SelectedItems.Clear();
|
||||
foreach (var item in (IEnumerable)newValue)
|
||||
{
|
||||
behavior.AssociatedObject.SelectedItems.Add(item);
|
||||
}
|
||||
|
||||
behavior.AssociatedObject.SelectionChanged += behavior.ListBoxSelectionChanged;
|
||||
newValue.CollectionChanged += behavior.SourceCollectionChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isUpdatingTarget;
|
||||
private bool _isUpdatingSource;
|
||||
|
||||
private void SourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (_isUpdatingSource)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdatingTarget = true;
|
||||
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (var item in e.OldItems)
|
||||
{
|
||||
AssociatedObject.SelectedItems.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (var item in e.NewItems)
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingTarget = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (_isUpdatingTarget)
|
||||
return;
|
||||
|
||||
var selectedItems = SelectedItems;
|
||||
if (selectedItems == null)
|
||||
return;
|
||||
//this could be a bulk operation, turn off notifications if consumer is paying attention
|
||||
SelectedItemsStatus.SetUpdating(SelectedItems, true);
|
||||
var itemsToRemove = new List<object>();
|
||||
try
|
||||
{
|
||||
_isUpdatingSource = true;
|
||||
foreach (var item in e.RemovedItems)
|
||||
{
|
||||
itemsToRemove.Add(item);
|
||||
}
|
||||
|
||||
var itemsToAdd = new List<object>();
|
||||
|
||||
foreach (var item in e.AddedItems)
|
||||
{
|
||||
if (!selectedItems.Contains(item))
|
||||
{
|
||||
itemsToAdd.Add(item);
|
||||
}
|
||||
}
|
||||
var parentType = selectedItems.GetType();
|
||||
var type = selectedItems.GetType().GenericTypeArguments[0];
|
||||
|
||||
if (parentType.IsGenericType && parentType.GetGenericTypeDefinition() == typeof(BulkObservableCollection<>)
|
||||
&& type == typeof(IAnalogSensor)||type == typeof(ITestSetup))
|
||||
{
|
||||
BulkOperations(itemsToRemove, itemsToAdd, selectedItems, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveItems(itemsToRemove, selectedItems);
|
||||
AddItems(itemsToAdd, type, selectedItems);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingSource = false;
|
||||
}
|
||||
}
|
||||
private static void BulkOperations(List<object> itemsToRemove, IList<object> itemsToAdd, IList selectedItems, Type type)
|
||||
{
|
||||
switch (type.Name)
|
||||
{
|
||||
case "IAnalogSensor":
|
||||
BulkOperationsAnalogSensor(itemsToRemove, itemsToAdd, selectedItems);
|
||||
break;
|
||||
case "ITestSetup":
|
||||
BulkOperationsTestSetup(itemsToRemove, itemsToAdd, selectedItems);
|
||||
break;
|
||||
}
|
||||
}
|
||||
private static void BulkOperationsAnalogSensor(List<object> itemsToRemove, IList<object> itemsToAdd, IList selectedItems)
|
||||
{
|
||||
var collection = selectedItems as BulkObservableCollection<IAnalogSensor>;
|
||||
var sensorsToAdd = itemsToAdd.Cast<IAnalogSensor>().ToArray();
|
||||
var sensorsToRemove = itemsToRemove.Cast<IAnalogSensor>().ToArray();
|
||||
RemoveItems(sensorsToRemove, collection);
|
||||
AddItems(sensorsToAdd, collection);
|
||||
}
|
||||
private static void BulkOperationsTestSetup(List<object> itemsToRemove, IList<object> itemsToAdd, IList selectedItems)
|
||||
{
|
||||
var collection = selectedItems as BulkObservableCollection<ITestSetup>;
|
||||
var toAdd = itemsToAdd.Cast<ITestSetup>().ToArray();
|
||||
var toRemove = itemsToRemove.Cast<ITestSetup>().ToArray();
|
||||
RemoveItems(toRemove, collection);
|
||||
AddItems(toAdd, collection);
|
||||
}
|
||||
private static void RemoveItems(List<object> itemsToRemove, IList selectedItems)
|
||||
{
|
||||
if (null == itemsToRemove || null == selectedItems) { return; }
|
||||
foreach (var item in itemsToRemove)
|
||||
{
|
||||
selectedItems.Remove(item);
|
||||
}
|
||||
}
|
||||
private static void RemoveItems(IAnalogSensor[] itemsToRemove, BulkObservableCollection<IAnalogSensor> collection)
|
||||
{
|
||||
if (null == itemsToRemove || !itemsToRemove.Any()) { return; }
|
||||
if (null == collection) { return; }
|
||||
collection.RemoveRange(itemsToRemove);
|
||||
}
|
||||
private static void RemoveItems(ITestSetup[] itemsToRemove, BulkObservableCollection<ITestSetup> collection)
|
||||
{
|
||||
if (null == itemsToRemove || !itemsToRemove.Any()) { return; }
|
||||
if (null == collection) { return; }
|
||||
collection.RemoveRange(itemsToRemove);
|
||||
}
|
||||
private static void AddItems(ITestSetup[] itemsToAdd, BulkObservableCollection<ITestSetup> collection)
|
||||
{
|
||||
if (null == itemsToAdd || !itemsToAdd.Any()) { return; }
|
||||
if (null == collection) { return; }
|
||||
collection.AddRange(itemsToAdd);
|
||||
}
|
||||
private static void AddItems(IAnalogSensor[] itemsToAdd, BulkObservableCollection<IAnalogSensor> collection)
|
||||
{
|
||||
if (null == itemsToAdd || !itemsToAdd.Any()) { return; }
|
||||
if (null == collection) { return; }
|
||||
collection.AddRange(itemsToAdd);
|
||||
}
|
||||
private void AddItems(List<object> itemsToAdd, Type type, IList selectedItems)
|
||||
{
|
||||
foreach (var item in itemsToAdd)
|
||||
{
|
||||
if (item == itemsToAdd[itemsToAdd.Count-1])
|
||||
{
|
||||
//if this is the last item, turn notifications back on
|
||||
SelectedItemsStatus.SetUpdating(SelectedItems, false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (type.IsInstanceOfType(item))
|
||||
{
|
||||
selectedItems.Add(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace DTS.Common.Enums.TTS
|
||||
{
|
||||
/// <summary>
|
||||
/// used to indicate the current support for the field
|
||||
/// 18396 TTS import has too many columns and it makes confusion
|
||||
/// </summary>
|
||||
public enum FieldSupportLevel
|
||||
{
|
||||
RequiredParameter,
|
||||
RemainedButNotUsed,
|
||||
RemovedParameter
|
||||
}
|
||||
/// <summary>
|
||||
/// an attribute that can be used to mark fields as required, ignore, or removed
|
||||
/// used in 18396 but could be applied to other enums pretty easily
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class FieldSupportAttribute : Attribute
|
||||
{
|
||||
public FieldSupportLevel SupportLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// constructs a <see cref="ExcitationVoltageOptions.VoltageMagnitudeAttribute" />
|
||||
/// with a given value
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public FieldSupportAttribute(FieldSupportLevel value) { SupportLevel = value; }
|
||||
|
||||
/// <summary>
|
||||
/// returns the support level for the enum value
|
||||
/// </summary>
|
||||
/// <param name="genericEnum"></param>
|
||||
/// <returns></returns>
|
||||
public static FieldSupportLevel GetSupportLevel(Enum genericEnum)
|
||||
{
|
||||
Type genericEnumType = genericEnum.GetType();
|
||||
var memberInfo = genericEnumType.GetMember(genericEnum.ToString());
|
||||
if ((memberInfo != null && memberInfo.Length > 0))
|
||||
{
|
||||
var attribs = memberInfo[0].GetCustomAttributes(typeof(FieldSupportAttribute), false);
|
||||
if (attribs != null && attribs.Any())
|
||||
{
|
||||
return ((FieldSupportAttribute)attribs.ElementAt(0)).SupportLevel;
|
||||
}
|
||||
}
|
||||
return FieldSupportLevel.RemovedParameter;
|
||||
}
|
||||
}
|
||||
public enum ToyotaFieldOrder
|
||||
{
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
ChannelNumber = 0,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
ChannelCode = 1,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
JCodeOrDescription = 2,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
ChannelRange = 3,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
ChannelFilterHz = 4,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
SensorID = 5,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
SensorSerialNumber = 6,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
SensorSensitivity = 7,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
SensorExcitationVolts = 8,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
SensorCapacity = 9,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
SensorEU = 10,
|
||||
[FieldSupport(FieldSupportLevel.RequiredParameter)]
|
||||
SensorPolarity = 11,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
ChannelType = 12,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
Description = 13,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
ProportionalToExcitation = 14,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
BridgeResistance = 15,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
InitialOffsetVoltage = 16,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
InitialOffsetVoltageTolerance = 17,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
RemoveOffset = 18,
|
||||
[FieldSupport(FieldSupportLevel.RemainedButNotUsed)]
|
||||
ZeroMethod = 19,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
CableCompensationMultiplier = 20,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
InitialEUInMV = 21,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
InitialEUInEU = 22,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
IRTRACCExponent = 23,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
PolynomialConstant = 24,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
PolynomialCoefficentC = 25,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
PolynomialCoefficentB = 26,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
PolynomialCoefficentA = 27,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
PolynomialCoefficentAlpha = 28,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
ISOCode = 29,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
ISODescription = 30,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
ISOPolarity = 31,
|
||||
[FieldSupport(FieldSupportLevel.RemovedParameter)]
|
||||
KyowaSpecificField_1 = 32, //http://fogbugz/fogbugz/default.asp?5433
|
||||
}
|
||||
public enum ToyotaBridgeType
|
||||
{
|
||||
[Description("Full Bridge")]
|
||||
FullBridge,
|
||||
[Description("Half Bridge")]
|
||||
HalfBridge,
|
||||
[Description("Voltage")]
|
||||
Voltage,
|
||||
[Description("PotentiometerFB")]
|
||||
PotentionmeterFullBridge,
|
||||
[Description("PotentiometerHB")]
|
||||
PotentionmeterHalfBridge,
|
||||
[Description("IRTRACC")]
|
||||
IRTRACC,
|
||||
[Description("LinearChestPot")]
|
||||
LinearChestPot
|
||||
}
|
||||
public enum ToyotaZeroMethods
|
||||
{
|
||||
[Description("0")]
|
||||
None = 0,
|
||||
[Description("1")]
|
||||
AverageOverTime = 1,
|
||||
[Description("2")]
|
||||
UsePreEventDiagnosticsZero = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace DTS.Common.Utils
|
||||
{
|
||||
public class XMLUtils
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common
|
||||
{
|
||||
public interface IDownloadDataViewModel : IBaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<sys:Double x:Key="MaxDropDownWidth">500</sys:Double>
|
||||
<!-- SimpleStyles: ComboBox -->
|
||||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="20" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Grid.ColumnSpan="1"
|
||||
Grid.Column="1"
|
||||
Background="{StaticResource Brush_FlatControlWindowBackground}"
|
||||
BorderBrush="{StaticResource NormalBorderBrush}"
|
||||
BorderThickness="0" />
|
||||
<Border
|
||||
x:Name="Content_Text"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,1,0"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource Brush_FlatControlWindowBackground}"
|
||||
BorderBrush="{StaticResource DefaultedBorderBrush}"
|
||||
BorderThickness="0" />
|
||||
<Path
|
||||
x:Name="Arrow"
|
||||
Grid.Column="1"
|
||||
Fill="{StaticResource GlyphBrush}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Data="M 0 0 L 4 4 L 8 0 Z"/>
|
||||
<Path
|
||||
x:Name="Lock"
|
||||
Grid.Column="0"
|
||||
Data="M5.5,3.5730734 C5.152669,3.5730734 4.8814287,3.5981388 4.6862793,3.6482687 C4.4911294,3.6983995 4.3452148,3.780756 4.2485352,3.895339 C4.1518555,4.0099225 4.0918779,4.1612082 4.0686035,4.3491964 C4.0453286,4.5371847 4.0336914,4.7672467 4.0336914,5.039382 L4.0336914,5.8826437 L6.9663086,5.8826437 L6.9663086,5.039382 C6.9663086,4.7672467 6.9555664,4.5371847 6.934082,4.3491964 C6.9125977,4.1612082 6.8544106,4.0099225 6.7595215,3.895339 C6.6646318,3.780756 6.5187173,3.6983995 6.3217773,3.6482687 C6.1248369,3.5981388 5.8509111,3.5730734 5.5,3.5730734 z M5.5,2.461257 C6.0514321,2.461257 6.4945474,2.5266056 6.8293457,2.6573019 C7.1641436,2.7879992 7.4219561,2.9688253 7.6027832,3.1997824 C7.7836099,3.4307399 7.9035645,3.7037706 7.9626465,4.0188742 C8.0217285,4.3339787 8.0512695,4.6741476 8.0512695,5.039382 L8.0512695,5.9094992 C8.1515293,5.9094992 8.248209,5.9291935 8.3413086,5.9685812 C8.4344072,6.0079694 8.5158691,6.0607853 8.5856934,6.1270285 C8.6555176,6.1932721 8.7110186,6.2702579 8.7521973,6.3579855 C8.793375,6.4457135 8.8139648,6.5379171 8.8139648,6.6345968 L8.8139648,10.67903 C8.8139648,10.782871 8.795166,10.879551 8.7575684,10.969069 C8.7199707,11.058588 8.6671543,11.138259 8.5991211,11.208083 C8.5310869,11.277907 8.4523106,11.332514 8.362793,11.371902 C8.2732744,11.411289 8.1783848,11.430984 8.078125,11.430984 L2.9379883,11.430984 C2.834147,11.430984 2.7365723,11.411289 2.6452637,11.371902 C2.5539551,11.332514 2.4742837,11.277907 2.40625,11.208083 C2.3382161,11.138259 2.2845051,11.058588 2.2451172,10.969069 C2.205729,10.879551 2.1860352,10.782871 2.1860352,10.67903 L2.1860352,6.6345968 C2.1860352,6.5379171 2.2066243,6.4457135 2.2478027,6.3579855 C2.288981,6.2702579 2.3444824,6.1932721 2.4143066,6.1270285 C2.4841309,6.0607853 2.563802,6.0079694 2.6533203,5.9685812 C2.7428384,5.9291935 2.8377278,5.9094992 2.9379883,5.9094992 L2.9379883,5.039382 C2.9379883,4.6741476 2.9684243,4.3339787 3.0292969,4.0188742 C3.0901692,3.7037706 3.2128091,3.4307399 3.3972168,3.1997824 C3.581624,2.9688253 3.8412271,2.7879992 4.1760254,2.6573019 C4.5108232,2.5266056 4.9521484,2.461257 5.5,2.461257 z"
|
||||
HorizontalAlignment="Right"
|
||||
Height="8.97" Margin="5" Stretch="Fill"
|
||||
VerticalAlignment="Center"
|
||||
Width="6.628"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{StaticResource Brush_FlatControlMouseOverBackground}" />
|
||||
<Setter TargetName="Content_Text" Property="Background" Value="{StaticResource Brush_FlatControlMouseOverBackground}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{StaticResource Brush_FlatControlMouseOverBackground}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Lock" Property="Fill" Value="{StaticResource Brush_FlatControlDisabledForeground}"/>
|
||||
<Setter TargetName="Border" Property="Background" Value="{StaticResource Brush_FlatControlDisabledBackground}" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Brush_FlatControlBorder}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush_FlatControlDisabledForeground}"/>
|
||||
<Setter TargetName="Content_Text" Property="Background" Value="{StaticResource Brush_FlatControlDisabledBackground}"/>
|
||||
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource Brush_FlatControlDisabledForeground}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox" >
|
||||
<Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="FlatComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<!--7873 Font size is smaller in Name field than in combo-box fields-->
|
||||
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||
<Setter Property="MinWidth" Value="40"/>
|
||||
<Setter Property="Height" Value="22" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Margin" Value="5,2,5,2"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<Grid>
|
||||
<ToggleButton Name="ToggleButton"
|
||||
Template="{StaticResource ComboBoxToggleButton}"
|
||||
Grid.Column="2"
|
||||
Focusable="false"
|
||||
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ClickMode="Press">
|
||||
</ToggleButton>
|
||||
<ContentPresenter Name="ContentSite"
|
||||
IsHitTestVisible="False"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
Margin="3,0,23,0"
|
||||
VerticalAlignment="Center"
|
||||
TextBlock.Foreground="{TemplateBinding Foreground}"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBox x:Name="PART_EditableTextBox"
|
||||
Style="{x:Null}"
|
||||
Template="{StaticResource ComboBoxTextBox}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="3,0,23,0"
|
||||
Focusable="True"
|
||||
Background="Transparent"
|
||||
Visibility="Hidden"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"/>
|
||||
<Popup Name="Popup"
|
||||
Placement="Bottom"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
PopupAnimation="Slide">
|
||||
<Grid Name="DropDown"
|
||||
SnapsToDevicePixels="True"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}"
|
||||
MaxWidth="{TemplateBinding ActualWidth}"
|
||||
MinWidth="{TemplateBinding ActualWidth}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}">
|
||||
<Border x:Name="DropDownBorder"
|
||||
Background="{StaticResource Brush_FlatControlWindowBackground}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{StaticResource SolidBorderBrush}"/>
|
||||
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True" Visibility="Visible">
|
||||
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush_FlatControlDisabledForeground}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsGrouping" Value="true">
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
|
||||
</Trigger>
|
||||
<Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
|
||||
<Setter TargetName="DropDownBorder" Property="Margin" Value="0,0,0,0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEditable" Value="true">
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FlatComboBoxStyleWideDrop" TargetType="ComboBox">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<!--7873 Font size is smaller in Name field than in combo-box fields-->
|
||||
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||
<Setter Property="MinWidth" Value="40"/>
|
||||
<Setter Property="Height" Value="22" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Margin" Value="5,2,5,2"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<Grid>
|
||||
<ToggleButton Name="ToggleButton"
|
||||
Template="{StaticResource ComboBoxToggleButton}"
|
||||
Grid.Column="2"
|
||||
Focusable="false"
|
||||
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ClickMode="Press">
|
||||
</ToggleButton>
|
||||
<ContentPresenter Name="ContentSite"
|
||||
IsHitTestVisible="False"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
Margin="3,0,23,0"
|
||||
VerticalAlignment="Center"
|
||||
TextBlock.Foreground="{TemplateBinding Foreground}"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBox x:Name="PART_EditableTextBox"
|
||||
Style="{x:Null}"
|
||||
Template="{StaticResource ComboBoxTextBox}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="3,0,23,0"
|
||||
Focusable="True"
|
||||
Background="Transparent"
|
||||
Visibility="Hidden"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"/>
|
||||
<Popup Name="Popup"
|
||||
Placement="Bottom"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
PopupAnimation="Slide">
|
||||
<Grid Name="DropDown"
|
||||
SnapsToDevicePixels="True"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}"
|
||||
MaxWidth="{StaticResource MaxDropDownWidth}"
|
||||
MinWidth="{TemplateBinding ActualWidth}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}">
|
||||
<Border x:Name="DropDownBorder"
|
||||
Background="{StaticResource Brush_FlatControlWindowBackground}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{StaticResource SolidBorderBrush}"/>
|
||||
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True" Visibility="Visible">
|
||||
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush_FlatControlDisabledForeground}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsGrouping" Value="true">
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
|
||||
</Trigger>
|
||||
<Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
|
||||
<Setter TargetName="DropDownBorder" Property="Margin" Value="0,0,0,0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEditable" Value="true">
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- SimpleStyles: ComboBoxItem -->
|
||||
<Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border
|
||||
Name="Border"
|
||||
Padding="0"
|
||||
SnapsToDevicePixels="true">
|
||||
<ContentPresenter />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsHighlighted" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{StaticResource Brush_FlatControlSelectedBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush_FlatControlSelectedForeground}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush_FlatControlForeground}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="{x:Type ComboBox}" TargetType="ComboBox" BasedOn="{StaticResource FlatComboBoxStyle}" />
|
||||
|
||||
<Style x:Key="PageContentComboBoxStyle" TargetType="ComboBox" BasedOn="{StaticResource FlatComboBoxStyle}" >
|
||||
<Setter Property="Margin" Value="5,2,5,2" />
|
||||
<Setter Property="Height" Value="22" />
|
||||
</Style>
|
||||
<Style x:Key="PageContentComboBoxErrorStyle" TargetType="ComboBox" BasedOn="{StaticResource PageContentComboBoxStyle}">
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="BorderBrush" Value="Red" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user