本文整理汇总了C#中BindingList.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.FirstOrDefault方法的具体用法?C# BindingList.FirstOrDefault怎么用?C# BindingList.FirstOrDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.FirstOrDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZoneSelectationViewModel
public ZoneSelectationViewModel(Device device)
{
Title = "Выбор зоны устройства " + device.PresentationAddressAndName;
CreateCommand = new RelayCommand(OnCreate);
EditCommand = new RelayCommand(OnEdit, CanEdit);
Device = device;
IsGuardDevice = (device.Driver.DeviceType == DeviceType.Sequrity);
Zones = new BindingList<ZoneViewModel>();
foreach (var zone in from zone in FiresecManager.Zones orderby zone.No select zone)
{
var isGuardZone = (zone.ZoneType == ZoneType.Guard);
if (isGuardZone ^ IsGuardDevice)
continue;
if (device.Driver.DriverType == DriverType.StopButton || device.Driver.DriverType == DriverType.StartButton || device.Driver.DriverType == DriverType.AutomaticButton)
{
if (!zone.DevicesInZone.Any(x => x.Driver.DriverType == DriverType.MPT))
continue;
}
var zoneViewModel = new ZoneViewModel(zone);
Zones.Add(zoneViewModel);
}
if (Device.Zone != null)
SelectedZone = Zones.FirstOrDefault(x => x.Zone == Device.Zone);
}
示例2: OnPropertyChanged
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
if (e.Property == BrushProperty) {
if (Brush != null) {
GradientStops = new BindingList<GradientStop>(Brush.GradientStops);
SelectedStop = GradientStops.FirstOrDefault();
}
else {
GradientStops = null;
}
}
}