text stringlengths 1 22.8M |
|---|
Pontus Carlsson (born December 18, 1982) is a Swedish chess grandmaster.
Early life
When Carlsson was one year old, his family died. He was subsequently adopted by a Swedish couple and it was his stepfather, Ingvar Carlsson (former chairman of the Swedish Chess Federation), who taught him the game of chess when he was 4.
He studied Spanish during the time he was based in Spain, playing in the chess league. Now he is fluent in Spanish (having earned a certificate).
He is a dual citizen of Sweden and Colombia.
Chess career
Carlsson has represented his country since his school years and is now a member of the senior national team. He has spent most of his chess career traveling throughout Europe. His first international tournament of record was the under-10 European Championships in Rimavská Sobota.
Having a propensity for rapid chess, he has won the Swedish Tusenmannaschacket Rapid tournament three times, becoming the only player in its history to do so.
Carlsson also won a number of youth championships at the national and regional level. He played in his first national championship in 2001 at age 18 in his hometown of Linköping.
His performance stagnated from mid-2001 to mid-2005 due to losing small amounts of rating points in successive tournaments during that period. He attributed this delay to not playing enough tournaments and activating himself.
In 2007, Carlsson played for the Swedish national team in the 16th European Team Chess Championship and scored 6/9 without a loss. His performance rating was 2686, having faced strong opposition, including Dmitry Jakovenko and Mark Hebden. He was also a member of the national team at the 2006 37th Chess Olympiad in Turin (+3=1−2).
He plays for the Sollentuna SK chess club, with which he took part in the European club cups in 2002, 2005, and 2007. Beyond the Swedish league he has also played in the Spanish league and other tournaments in Spain.
Carlsson became an International Master and Grandmaster in three years. He achieved the IM title in August 2005, and the grandmaster title in October 2007 after earning four GM norms. This made him the 16th Swede to become a GM. He earned his first GM norm at the 2005 European Team Championship, his second at the Open de Tarragona (Spain), the third at the Torneig Internacional Ciutat de Sóller, and the fourth in the 3rd round at the European Club Cup.
Having received the Grandmaster title, he is to be elected into the Swedish Chess Academy. The Chess Academy is an organization of dignitaries and sponsors of chess, and all Swedish Grandmasters are members.
His long-term goal is reach the 2600 rating mark. He says that he is undergoing a serious training program, including both Mark Dvoretsky's Dvoretsky's Endgame Manual and New in Chess magazine as part of it.
Quotes
"The training that I have done this far have taken me to 2500, but in order to reach 2600 I need to work hard on my weaknesses."
"Before that I only played two or max three ELO tournaments per year. Between 2001 and 2004 I had problems to reach my normal playing strength during the tournaments since I was too rusty all the time. I always started the tournaments bad and then when I got warm and recovered, the tournament was over and it was a half year left to the next one. I had 2400 in 2001 and in 2004 I had 2360 after losing five ELO points in almost every tournament that I played during this period. Therefore I decided to activate myself and start to play more and a bit more serious."
"No I don't think so. I mean there are only two black GMs in the world and I'm the only one that plays in Europe so everyone knows who I am. It's not possible for me to hide!" (when asked if international opponents are surprised when placing his name and country with his face)
References
External links
Articles on Pontus Carlsson at the Chess Drum
1982 births
Living people
Swedish adoptees
Chess grandmasters
Swedish chess players
Swedish people of Colombian descent |
Erika Wanenmacher (born 1955) is a sculptor and installation artist from Santa Fe, New Mexico, a self-described "maker of things." She has said, "I believe objects that are made with intent carry resonance that can shift energy, power, and beliefs. They're about magic and changing consciousness." Wanenmacher's work has been shown nationally and internationally. Her sculptures incorporate many materials and techniques including forged steel, carved and painted wood, cast aluminum, and large-scale installations. She is represented in Los Angeles, CA by Blythe Projects.
Artwork
The major themes in Wanenmacher's handmade sculptures and installation include the conflicts between nature and culture; U.S. atomic history, and magic and witchcraft. The art critic Michael Abatemarco has written that Wanenmacher's work reveals the medicinal and metaphysical properties of plants and the relationship between the botanical realm and human beings and other animals. Several of her works have addressed the legacy of atomic weapons, including the human radiation experiments during the Cold War. Her installation, "The Science Club, The Boy's Room, Now, Forever, Then, Part 1", examines the relationship between U.S. atomic history and culture, to critique the progress of science, and the adverse effects of the pursuits of nuclear physics. She has used surplus objects from Los Alamos National Laboratory, obtained through Ed Grothus' The Black Hole surplus company.
Notable exhibits
Selected solo exhibitions
Boulder Museum of Contemporary Art, Boulder, CO. "The Science Club: The Boy's Room, Now, Forever, Then, Part 1. 2008
Linda Durham Gallery, Santa Fe, NM. "Where have you been (come to your senses)" 2010. "Ditch Witch" 2009. "I Stole Stealth (Coyote Taught Me) 2007.
SITE Santa Fe, Santa Fe, NM. "Grimoire" 2001.
Center for Contemporary Arts, Santa Fe, NM. "Coniunctio: A Twenty-Year Survey". 1996.
Selected group exhibitions
Contemporary Museum Saint Louis, Saint Louis, MO. "Cryptic: The Use of Allegory in Contemporary Art with a Master Class from Goya". 2011
Albright-Knox Museum of Art, Buffalo, NY. "Surveyor" 2011
New Mexico Museum of Art, Santa Fe, NM. "Case Studies From the Bureau of Contemporary Art" 2011
Tweed Museum, Duluth, MN' "Botanica: Contemporary Artists and the World of Plants" (traveling exhibition) 1999-2001
Notable collections
Albright-Knox Museum of Art, Buffalo, NY.
Fisher Landau Center, Long Island City, NY.
New Mexico Museum of Art, Santa Fe, NM.
References
External links
Erika Wanenmacher: Culture Witch, official website
1955 births
Living people
American women artists
Contemporary sculptors
American installation artists
Kansas City Art Institute alumni
People from Berea, Ohio
Artists from Santa Fe, New Mexico
21st-century American women |
Alexandra Fusai and Kerry-Anne Guse were the defending champions but only Guse competed that year with Rika Hiraki.
Guse and Hiraki won in the final 6–1, 7–6 against Maureen Drake and Renata Kolbovic.
Seeds
Champion seeds are indicated in bold text while text in italics indicates the round in which those seeds were eliminated.
Rachel McQuillan / Nana Miyagi (first round)
Kerry-Anne Guse / Rika Hiraki (champions)
Sung-Hee Park / Shi-Ting Wang (quarterfinals)
Henrieta Nagyová / Dominique Van Roost (first round)
Draw
External links
1997 Wismilak International Doubles Draw
Commonwealth Bank Tennis Classic
1997 WTA Tour |
The discography of Dream Theater, an American progressive metal band, consists of fifteen studio albums, one extended play, nine live albums, one compilation album, eight video albums, nine singles, and twenty-one music videos. The band was formed under the name Majesty by guitarist John Petrucci, bassist John Myung, and drummer Mike Portnoy while the three of them were attending Berklee College of Music in September 1985. The trio added keyboard player Kevin Moore and vocalist Chris Collins in order to complete their lineup. After the band released a demo entitled The Majesty Demos, Collins was replaced by Charlie Dominici in November 1987.
The group signed with Mechanic Records, and released its debut album When Dream and Day Unite in 1989. Before the album's release the group agreed to change their name to "Dream Theater", inspired by a now-demolished California movie theater. After firing Dominici, Dream Theater hired Canadian vocalist James LaBrie in 1991. LaBrie's debut album was Images and Words, which was the band's first and only gold-certified album by the Recording Industry Association of America (RIAA), having sold more than 500,000 copies. Moore left the group after the recording of 1994's Awake and was replaced by Derek Sherinian for the album's tour—he was later hired as a full member, appearing on the EP A Change of Seasons and the full album Falling Into Infinity. The double live album Once in a LIVEtime was released in 1998.
In 1999, Jordan Rudess was hired to replace Sherinian. Rudess's first work was Scenes from a Memory, a concept album that followed the story of a murder mystery. In 2002, the group released Six Degrees of Inner Turbulence, followed by Train of Thought in 2003, and Octavarium in 2005. Two more live albums were also released in this time period, and a new one, titled Score, was released for the band's 20th anniversary and featured the band backed by a 29-piece orchestra. It was followed a year later by their ninth studio album, Systematic Chaos. Dream Theater's tenth studio album, Black Clouds & Silver Linings, the band's second under Roadrunner Records; was released on June 23, 2009.
In September 2010, founding drummer Mike Portnoy announced that he was leaving the band. The band filmed a documentary ("The Spirit Carries On") of their search for a replacement who they found in Berklee professor Mike Mangini. In 2011, Dream Theater released their eleventh studio album A Dramatic Turn of Events and its eponymous album in 2013, their first album featuring composition from him. The band released their eleventh music video for "On the Backs of Angels" on October 4, 2011, a song which was subsequently nominated for a Grammy award.
On December 6, 2013, it was announced that the lead single from Dream Theater's self-titled album, "The Enemy Inside" was nominated for the Best Metal Performance Grammy Award. This is the band's second consecutive Grammy nomination. The band's thirteenth studio album, The Astonishing, was released in January 2016. It was followed with the release of their fourteenth studio album, Distance over Time, in February 2019.
On November 27, 2020, Dream Theater released their ninth live album, Distant Memories - Live in London. This was soon followed by the release of their 15th studio album, A View from the Top of the World, which won the band their first Grammy with its lead single, "The Alien."
Dream Theater has sold over two million records and DVDs in the United States and over 12 million records and DVDs throughout the world.
Albums
Studio albums
Live albums
Compilation albums
Extended plays
Singles
Main singles
A^ - Record Store Day exclusive.
B^ - Released on December 1, 2020, for the help of the touring crew of Dream Theater because of the COVID-19 pandemic.
Promotional singles
Other appearances
Videos
Video albums
Music videos
Fanclub releases
Official bootlegs
See also
List of Dream Theater songs
References
General
Specific
External links
Dream Theater discography at their official website
Heavy metal group discographies
Discographies of American artists |
Mezdeh (, also Romanized as Mazdeh; also known as Maija and Mazdābād) is a village in Tarq Rud Rural District, in the Central District of Natanz County, Isfahan Province, Iran. At the 2006 census, its population was 203, in 71 families.
References
Populated places in Natanz County |
Myadora striata is a species of saltwater clam, a marine bivalve mollusc in the family Myochamidae.
References
Powell A. W. B., New Zealand Mollusca, William Collins Publishers Ltd, Auckland, New Zealand 1979
Glen Pownall, New Zealand Shells and Shellfish, Seven Seas Publishing Pty Ltd, Wellington, New Zealand 1979
Myochamidae
Bivalves of New Zealand
Bivalves described in 1835 |
Jonathan Uhry Newman (January 9, 1927 – October 24, 1991) was an American attorney and judge.
Biography
Johnathan Newman was born on January 9, 1927, in San Francisco, California, to Rabbi Louis Israel Newman and Lucille Uhry Newman. He attended Ethical Culture Fieldston School and then went on to Yale University, graduating Phi Beta Kappa in 1948. He then attended Yale Law School, graduating in 1951.
In 1951, Newman married Carol Laura Spero, sister of artist, Nancy Spero.
In 1953, Newman moved to Portland, Oregon, where he practiced law. He was a founding member of the American Civil Liberties Union of Oregon, serving as its first secretary and as a board member between 1955-1968. In 1982, the Oregon ACLU awarded him its highest honor, the E.B. MacNaughton Civil Liberties Award.
From 1968-1979 Newman served on the Portland school board and was "a driving force behind desegregating the schools". In 1982, he was elected to the Oregon Court of Appeals where he served until 1991. On October 24, 1991, Newman died of leukemia in Portland, Oregon.
He routinely hiked on the weekends throughout the 1950s until his death and Newman's memorial service was held at the base of the Topspur Trailhead (#785) in the Mount Hood National Forest where his friends dedicated a plaque. It sits on a stone at the beginning of the trail as of August 2016.
The annual Jonathan U. Newman Legal Citizen of the Year Award given by Classroom Law Project to recognize leadership in civic education and engagement is named after Judge Newman.
References
1927 births
1991 deaths
Jewish American attorneys
Lawyers from San Francisco
Lawyers from Portland, Oregon
Oregon Court of Appeals judges
Yale Law School alumni
School board members in Oregon
Ethical Culture Fieldston School alumni
20th-century American judges |
```xml
import * as React from 'react';
import { styled } from '@mui/material/styles';
import { IconButton } from '@mui/material';
import ActionHide from '@mui/icons-material/RemoveCircleOutline';
import clsx from 'clsx';
import { useResourceContext, useTranslate } from 'ra-core';
export const FilterFormInput = props => {
const { filterElement, handleHide, className } = props;
const resource = useResourceContext(props);
const translate = useTranslate();
return (
<Root
data-source={filterElement.props.source}
className={clsx('filter-field', className)}
>
{React.cloneElement(filterElement, {
resource,
record: emptyRecord,
size: filterElement.props.size ?? 'small',
helperText: false,
// ignore defaultValue in Field because it was already set in Form (via mergedInitialValuesWithDefaultValues)
defaultValue: undefined,
})}
{!filterElement.props.alwaysOn && (
<IconButton
className={clsx(
'hide-filter',
FilterFormInputClasses.hideButton
)}
onClick={handleHide}
data-key={filterElement.props.source}
title={translate('ra.action.remove_filter')}
size="small"
>
<ActionHide />
</IconButton>
)}
<div className={FilterFormInputClasses.spacer}> </div>
</Root>
);
};
const PREFIX = 'RaFilterFormInput';
export const FilterFormInputClasses = {
spacer: `${PREFIX}-spacer`,
hideButton: `${PREFIX}-hideButton`,
};
const Root = styled('div', {
name: PREFIX,
overridesResolver: (props, styles) => styles.root,
})(({ theme }) => ({
display: 'flex',
alignItems: 'flex-end',
pointerEvents: 'auto',
[theme.breakpoints.down('sm')]: {
width: '100%',
},
[`& .${FilterFormInputClasses.spacer}`]: { width: theme.spacing(2) },
[`& .${FilterFormInputClasses.hideButton}`]: {
marginBottom: theme.spacing(1),
},
}));
const emptyRecord = {};
``` |
Seguyola vicina is a species of fungus gnat, first described by Loïc Matile in 1990, of the family Lygistorrhinidae. Its type locality is in Cameroon. There are no subspecies.
References
Sciaroidea |
A metatarsophalangeal joint sprain is an injury to the connective tissue between the foot and a toe (at a metatarsophalangeal joint, one of the joints in the ball of the foot). When the big toe is involved, it is known as "turf toe".
Causes
Turf toe is named from the injury being associated with playing sports on rigid surfaces such as artificial turf and is a fairly common injury among professional American football players. Often, the injury occurs when someone or something falls on the back of the calf while that leg's knee and tips of the toes are touching the ground. The toe is hyperextended and thus the joint is injured. Additionally, athletic shoes with very flexible soles combined with cleats that "grab" the turf will cause overextension of the big toe. This can occur on the lesser toes as well. It has also been observed in sports beyond American football, including soccer, baseball, basketball, rugby, volleyball, and tae kwon do. This is a primary reason why many athletes prefer natural grass to turf, because it is softer.
Treatment
The injury can be debilitating for athletes of many sports who need to accelerate, quickly change direction, or jump. Use of the toes is not possible during the healing process. Since the toes are necessary for proper push-off when accelerating, those sorts of athletic activities should be almost completely curtailed. An extended healing period of one or more months is often required.
Because of the anatomy of the distal foot and the unique use of the foot, it is often impossible to properly tape or brace the joint. Although difficult, it is not impossible to tape the toe to limit extension (upward bend of toe). Additionally, wearing a shoe with a rigid sole (often a metal plate) and cushioned innersole will help minimize extension of the joint. Anti-inflammatory medication, as well as physical therapy, is recommended.
Turf toe is usually healed in about 2–3 weeks. It can become more serious if left untreated, and may cause serious problems for the athlete. Treating the injury includes icing of the area, elevating the foot, or possibly the use of custom orthotics.
See also
Broken toe
Jogger's toe
References
External links
Foot diseases
Dislocations, sprains and strains
Toes |
American Fur Co. v. United States, 27 U.S. (2 Pet.) 358 (1829), was a United States Supreme Court case in which the Court held that the American Fur Company agent's acts and statements bound the company; that all goods were subject to seizure and forfeiture; but that the instructions on where in Indian territory the seizure could be made was in error to the point that a new trial was required.
Background
On September 24, 1824, a licensed Indian trader, William H. Wallace, was caught with seven kegs of whiskey and one keg of shrub among his goods he had for trade with the Indians. The local District Attorney moved for the district court to forfeit all of the goods to the government, and following a trial in which John Davis, an employee of Wallace, testified about the alcohol, the jury agreed and forfeited the goods to government.
Supreme Court
Justice Bushrod Washington delivered the opinion of the Court. Washington noted that Davis was an agent of Wallace, and that his statements could bind the principal. He further stated that all of the goods were subject to seizure, not just the alcohol, but that the instructions as to the location of the seizure to the jury was so confusing that a new trial was required.
References
External links
1829 in United States case law
United States Supreme Court cases
United States Supreme Court cases of the Marshall Court
American Fur Company |
Tino Rodríguez is a Mexican-American painter. Born and raised in Guadalajara, Mexico, Rodriguez was influenced by the symbolism and themes evident in the Catholic churches of his youth. His work was also influenced by his absorption of fairy tales.
His work incorporates fantastical imagery combining animal and human forms, as well as dream-like backgrounds and settings.
His work has been exhibited at numerous venues in San Francisco.
The exhibition Tino Rodríguez: The Darkening Garden/El Jardin al Anochecer was featured at the San Jose Museum of Art in 2003.
Rodriguez studied at the Sorbonne in 1990. He received his Bachelor of Fine Arts degree from the San Francisco Art Institute and his Master of Fine Arts from the University of New Mexico.
External links
Official Site
San Francisco Arts Commission Gallery
Arts Scene California
Year of birth missing (living people)
Living people
21st-century Mexican painters
Mexican male painters
Mexican emigrants to the United States
University of Paris alumni
University of New Mexico alumni
American artists of Mexican descent
Artists from Guadalajara, Jalisco
21st-century Mexican male artists |
```smalltalk
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Security;
using System.Text;
using Microsoft.Toolkit.Uwp.UI.Automation.Peers;
using Microsoft.Toolkit.Uwp.UI.Controls.DataGridInternals;
using Microsoft.Toolkit.Uwp.UI.Controls.Primitives;
using Microsoft.Toolkit.Uwp.UI.Controls.Utilities;
using Microsoft.Toolkit.Uwp.UI.Data.Utilities;
using Microsoft.Toolkit.Uwp.UI.Utilities;
using Microsoft.Toolkit.Uwp.Utilities;
using Windows.ApplicationModel.DataTransfer;
using Windows.Devices.Input;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.System;
using Windows.UI.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using DiagnosticsDebug = System.Diagnostics.Debug;
namespace Microsoft.Toolkit.Uwp.UI.Controls
{
/// <summary>
/// Control to represent data in columns and rows.
/// </summary>
#if FEATURE_VALIDATION_SUMMARY
[TemplatePart(Name = DataGrid.DATAGRID_elementValidationSummary, Type = typeof(ValidationSummary))]
#endif
[TemplatePart(Name = DataGrid.DATAGRID_elementRowsPresenterName, Type = typeof(DataGridRowsPresenter))]
[TemplatePart(Name = DataGrid.DATAGRID_elementColumnHeadersPresenterName, Type = typeof(DataGridColumnHeadersPresenter))]
[TemplatePart(Name = DataGrid.DATAGRID_elementFrozenColumnScrollBarSpacerName, Type = typeof(FrameworkElement))]
[TemplatePart(Name = DataGrid.DATAGRID_elementHorizontalScrollBarName, Type = typeof(ScrollBar))]
[TemplatePart(Name = DataGrid.DATAGRID_elementVerticalScrollBarName, Type = typeof(ScrollBar))]
[TemplateVisualState(Name = VisualStates.StateDisabled, GroupName = VisualStates.GroupCommon)]
[TemplateVisualState(Name = VisualStates.StateNormal, GroupName = VisualStates.GroupCommon)]
[TemplateVisualState(Name = VisualStates.StateTouchIndicator, GroupName = VisualStates.GroupScrollBars)]
[TemplateVisualState(Name = VisualStates.StateMouseIndicator, GroupName = VisualStates.GroupScrollBars)]
[TemplateVisualState(Name = VisualStates.StateMouseIndicatorFull, GroupName = VisualStates.GroupScrollBars)]
[TemplateVisualState(Name = VisualStates.StateNoIndicator, GroupName = VisualStates.GroupScrollBars)]
[TemplateVisualState(Name = VisualStates.StateSeparatorExpanded, GroupName = VisualStates.GroupScrollBarsSeparator)]
[TemplateVisualState(Name = VisualStates.StateSeparatorCollapsed, GroupName = VisualStates.GroupScrollBarsSeparator)]
[TemplateVisualState(Name = VisualStates.StateSeparatorExpandedWithoutAnimation, GroupName = VisualStates.GroupScrollBarsSeparator)]
[TemplateVisualState(Name = VisualStates.StateSeparatorCollapsedWithoutAnimation, GroupName = VisualStates.GroupScrollBarsSeparator)]
[TemplateVisualState(Name = VisualStates.StateInvalid, GroupName = VisualStates.GroupValidation)]
[TemplateVisualState(Name = VisualStates.StateValid, GroupName = VisualStates.GroupValidation)]
[StyleTypedProperty(Property = "CellStyle", StyleTargetType = typeof(DataGridCell))]
[StyleTypedProperty(Property = "ColumnHeaderStyle", StyleTargetType = typeof(DataGridColumnHeader))]
[StyleTypedProperty(Property = "DragIndicatorStyle", StyleTargetType = typeof(ContentControl))]
[StyleTypedProperty(Property = "DropLocationIndicatorStyle", StyleTargetType = typeof(Control))]
[StyleTypedProperty(Property = "RowHeaderStyle", StyleTargetType = typeof(DataGridRowHeader))]
[StyleTypedProperty(Property = "RowStyle", StyleTargetType = typeof(DataGridRow))]
public partial class DataGrid : Control
{
private enum ScrollBarVisualState
{
NoIndicator,
TouchIndicator,
MouseIndicator,
MouseIndicatorFull
}
private enum ScrollBarsSeparatorVisualState
{
SeparatorCollapsed,
SeparatorExpanded,
SeparatorExpandedWithoutAnimation,
SeparatorCollapsedWithoutAnimation
}
#if FEATURE_VALIDATION_SUMMARY
private const string DATAGRID_elementValidationSummary = "ValidationSummary";
#endif
private const string DATAGRID_elementRootName = "Root";
private const string DATAGRID_elementRowsPresenterName = "RowsPresenter";
private const string DATAGRID_elementColumnHeadersPresenterName = "ColumnHeadersPresenter";
private const string DATAGRID_elementFrozenColumnScrollBarSpacerName = "FrozenColumnScrollBarSpacer";
private const string DATAGRID_elementHorizontalScrollBarName = "HorizontalScrollBar";
private const string DATAGRID_elementRowHeadersPresenterName = "RowHeadersPresenter";
private const string DATAGRID_elementTopLeftCornerHeaderName = "TopLeftCornerHeader";
private const string DATAGRID_elementTopRightCornerHeaderName = "TopRightCornerHeader";
private const string DATAGRID_elementBottomRightCornerHeaderName = "BottomRightCorner";
private const string DATAGRID_elementVerticalScrollBarName = "VerticalScrollBar";
private const bool DATAGRID_defaultAutoGenerateColumns = true;
private const bool DATAGRID_defaultCanUserReorderColumns = true;
private const bool DATAGRID_defaultCanUserResizeColumns = true;
private const bool DATAGRID_defaultCanUserSortColumns = true;
private const DataGridGridLinesVisibility DATAGRID_defaultGridLinesVisibility = DataGridGridLinesVisibility.None;
private const DataGridHeadersVisibility DATAGRID_defaultHeadersVisibility = DataGridHeadersVisibility.Column;
private const DataGridRowDetailsVisibilityMode DATAGRID_defaultRowDetailsVisibility = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
private const DataGridSelectionMode DATAGRID_defaultSelectionMode = DataGridSelectionMode.Extended;
private const ScrollBarVisibility DATAGRID_defaultScrollBarVisibility = ScrollBarVisibility.Auto;
/// <summary>
/// The default order to use for columns when there is no <see cref="DisplayAttribute.Order"/>
/// value available for the property.
/// </summary>
/// <remarks>
/// The value of 10,000 comes from the DataAnnotations spec, allowing
/// some properties to be ordered at the beginning and some at the end.
/// </remarks>
private const int DATAGRID_defaultColumnDisplayOrder = 10000;
private const double DATAGRID_horizontalGridLinesThickness = 1;
private const double DATAGRID_minimumRowHeaderWidth = 4;
private const double DATAGRID_minimumColumnHeaderHeight = 4;
internal const double DATAGRID_maximumStarColumnWidth = 10000;
internal const double DATAGRID_minimumStarColumnWidth = 0.001;
private const double DATAGRID_mouseWheelDeltaDivider = 4.0;
private const double DATAGRID_maxHeadersThickness = 32768;
private const double DATAGRID_defaultRowHeight = 22;
internal const double DATAGRID_defaultRowGroupSublevelIndent = 20;
private const double DATAGRID_defaultMinColumnWidth = 20;
private const double DATAGRID_defaultMaxColumnWidth = double.PositiveInfinity;
private const double DATAGRID_defaultIncrementalLoadingThreshold = 3.0;
private const double DATAGRID_defaultDataFetchSize = 3.0;
// 2 seconds delay used to hide the scroll bars for example when OS animations are turned off.
private const int DATAGRID_noScrollBarCountdownMs = 2000;
// Used to work around double arithmetic rounding.
private const double DATAGRID_roundingDelta = 0.0001;
// DataGrid Template Parts
#if FEATURE_VALIDATION_SUMMARY
private ValidationSummary _validationSummary;
#endif
private UIElement _bottomRightCorner;
private DataGridColumnHeadersPresenter _columnHeadersPresenter;
private ScrollBar _hScrollBar;
private DataGridRowsPresenter _rowsPresenter;
private ScrollBar _vScrollBar;
private byte _autoGeneratingColumnOperationCount;
private bool _autoSizingColumns;
private List<ValidationResult> _bindingValidationResults;
private ContentControl _clipboardContentControl;
private IndexToValueTable<Visibility> _collapsedSlotsTable;
private bool _columnHeaderHasFocus;
private DataGridCellCoordinates _currentCellCoordinates;
// used to store the current column during a Reset
private int _desiredCurrentColumnIndex;
private int _editingColumnIndex;
private RoutedEventArgs _editingEventArgs;
private bool _executingLostFocusActions;
private bool _flushCurrentCellChanged;
private bool _focusEditingControl;
private FocusInputDeviceKind _focusInputDevice;
private DependencyObject _focusedObject;
private DataGridRow _focusedRow;
private FrameworkElement _frozenColumnScrollBarSpacer;
private bool _hasNoIndicatorStateStoryboardCompletedHandler;
private DispatcherQueueTimer _hideScrollBarsTimer;
// the sum of the widths in pixels of the scrolling columns preceding
// the first displayed scrolling column
private double _horizontalOffset;
private byte _horizontalScrollChangesIgnored;
private bool _ignoreNextScrollBarsLayout;
private List<ValidationResult> _indeiValidationResults;
private bool _initializingNewItem;
private bool _isHorizontalScrollBarInteracting;
private bool _isVerticalScrollBarInteracting;
// Set to True when the pointer is over the optional scroll bars.
private bool _isPointerOverHorizontalScrollBar;
private bool _isPointerOverVerticalScrollBar;
// Set to True to prevent the normal fade-out of the scroll bars.
private bool _keepScrollBarsShowing;
// Nth row of rows 0..N that make up the RowHeightEstimate
private int _lastEstimatedRow;
private List<DataGridRow> _loadedRows;
// prevents reentry into the VerticalScroll event handler
private Queue<Action> _lostFocusActions;
private bool _makeFirstDisplayedCellCurrentCellPending;
private bool _measured;
// the number of pixels of the firstDisplayedScrollingCol which are not displayed
private double _negHorizontalOffset;
// the number of pixels of DisplayData.FirstDisplayedScrollingRow which are not displayed
private int _noCurrentCellChangeCount;
private int _noFocusedColumnChangeCount;
private int _noSelectionChangeCount;
private double _oldEdgedRowsHeightCalculated = 0.0;
// Set to True to favor mouse indicators over panning indicators for the scroll bars.
private bool _preferMouseIndicators;
private DataGridCellCoordinates _previousAutomationFocusCoordinates;
private DataGridColumn _previousCurrentColumn;
private object _previousCurrentItem;
private List<ValidationResult> _propertyValidationResults;
private ScrollBarVisualState _proposedScrollBarsState;
private ScrollBarsSeparatorVisualState _proposedScrollBarsSeparatorState;
private string _rowGroupHeaderPropertyNameAlternative;
private ObservableCollection<Style> _rowGroupHeaderStyles;
// To figure out what the old RowGroupHeaderStyle was for each level, we need to keep a copy
// of the list. The old style important so we don't blow away styles set directly on the RowGroupHeader
private List<Style> _rowGroupHeaderStylesOld;
private double[] _rowGroupHeightsByLevel;
private double _rowHeaderDesiredWidth;
private Size? _rowsPresenterAvailableSize;
private bool _scrollingByHeight;
private DataGridSelectedItemsCollection _selectedItems;
private IndexToValueTable<Visibility> _showDetailsTable;
// Set to True when the mouse scroll bars are currently showing.
private bool _showingMouseIndicators;
private bool _successfullyUpdatedSelection;
private bool _temporarilyResetCurrentCell;
private bool _isUserSorting; // True if we're currently in a user invoked sorting operation
private ContentControl _topLeftCornerHeader;
private ContentControl _topRightCornerHeader;
private object _uneditedValue; // Represents the original current cell value at the time it enters editing mode.
private string _updateSourcePath;
private Dictionary<INotifyDataErrorInfo, string> _validationItems;
private List<ValidationResult> _validationResults;
private byte _verticalScrollChangesIgnored;
#if FEATURE_ICOLLECTIONVIEW_GROUP
private INotifyCollectionChanged _topLevelGroup;
#else
private IObservableVector<object> _topLevelGroup;
#endif
#if FEATURE_VALIDATION_SUMMARY
private ValidationSummaryItem _selectedValidationSummaryItem;
#endif
// An approximation of the sum of the heights in pixels of the scrolling rows preceding
// the first displayed scrolling row. Since the scrolled off rows are discarded, the grid
// does not know their actual height. The heights used for the approximation are the ones
// set as the rows were scrolled off.
private double _verticalOffset;
#if FEATURE_ICOLLECTIONVIEW_GROUP
// Cache event listeners for PropertyChanged and CollectionChanged events from CollectionViewGroups
private Dictionary<INotifyPropertyChanged, WeakEventListener<DataGrid, object, PropertyChangedEventArgs>> _groupsPropertyChangedListenersTable = new Dictionary<INotifyPropertyChanged, WeakEventListener<DataGrid, object, PropertyChangedEventArgs>>();
private Dictionary<INotifyCollectionChanged, WeakEventListener<DataGrid, object, NotifyCollectionChangedEventArgs>> _groupsCollectionChangedListenersTable = new Dictionary<INotifyCollectionChanged, WeakEventListener<DataGrid, object, NotifyCollectionChangedEventArgs>>();
#else
// Cache event listeners for VectorChanged events from ICollectionViewGroup's GroupItems
private Dictionary<IObservableVector<object>, WeakEventListener<DataGrid, object, IVectorChangedEventArgs>> _groupsVectorChangedListenersTable = new Dictionary<IObservableVector<object>, WeakEventListener<DataGrid, object, IVectorChangedEventArgs>>();
#endif
/// <summary>
/// Occurs one time for each public, non-static property in the bound data type when the
/// <see cref="ItemsSource"/> property is changed and the
/// <see cref="AutoGenerateColumns"/> property is true.
/// </summary>
public event EventHandler<DataGridAutoGeneratingColumnEventArgs> AutoGeneratingColumn;
/// <summary>
/// Occurs before a cell or row enters editing mode.
/// </summary>
public event EventHandler<DataGridBeginningEditEventArgs> BeginningEdit;
/// <summary>
/// Occurs after cell editing has ended.
/// </summary>
public event EventHandler<DataGridCellEditEndedEventArgs> CellEditEnded;
/// <summary>
/// Occurs immediately before cell editing has ended.
/// </summary>
public event EventHandler<DataGridCellEditEndingEventArgs> CellEditEnding;
/// <summary>
/// Occurs when the <see cref="Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumn.DisplayIndex"/>
/// property of a column changes.
/// </summary>
public event EventHandler<DataGridColumnEventArgs> ColumnDisplayIndexChanged;
/// <summary>
/// Occurs when the user drops a column header that was being dragged using the mouse.
/// </summary>
public event EventHandler<DragCompletedEventArgs> ColumnHeaderDragCompleted;
/// <summary>
/// Occurs one or more times while the user drags a column header using the mouse.
/// </summary>
public event EventHandler<DragDeltaEventArgs> ColumnHeaderDragDelta;
/// <summary>
/// Occurs when the user begins dragging a column header using the mouse.
/// </summary>
public event EventHandler<DragStartedEventArgs> ColumnHeaderDragStarted;
/// <summary>
/// Raised when column reordering ends, to allow subscribers to clean up.
/// </summary>
public event EventHandler<DataGridColumnEventArgs> ColumnReordered;
/// <summary>
/// Raised when starting a column reordering action. Subscribers to this event can
/// set tooltip and caret UIElements, constrain tooltip position, indicate that
/// a preview should be shown, or cancel reordering.
/// </summary>
public event EventHandler<DataGridColumnReorderingEventArgs> ColumnReordering;
/// <summary>
/// This event is raised by OnCopyingRowClipboardContent method after the default row content is prepared.
/// Event listeners can modify or add to the row clipboard content.
/// </summary>
public event EventHandler<DataGridRowClipboardEventArgs> CopyingRowClipboardContent;
/// <summary>
/// Occurs when a different cell becomes the current cell.
/// </summary>
public event EventHandler<EventArgs> CurrentCellChanged;
/// <summary>
/// Occurs after a <see cref="DataGridRow"/>
/// is instantiated, so that you can customize it before it is used.
/// </summary>
public event EventHandler<DataGridRowEventArgs> LoadingRow;
/// <summary>
/// Occurs when a new row details template is applied to a row, so that you can customize
/// the details section before it is used.
/// </summary>
public event EventHandler<DataGridRowDetailsEventArgs> LoadingRowDetails;
/// <summary>
/// Occurs before a DataGridRowGroupHeader header is used.
/// </summary>
public event EventHandler<DataGridRowGroupHeaderEventArgs> LoadingRowGroup;
/// <summary>
/// Occurs when a cell in a <see cref="DataGridTemplateColumn"/> enters editing mode.
/// </summary>
public event EventHandler<DataGridPreparingCellForEditEventArgs> PreparingCellForEdit;
/// <summary>
/// Occurs when the <see cref="RowDetailsVisibilityMode"/>
/// property value changes.
/// </summary>
public event EventHandler<DataGridRowDetailsEventArgs> RowDetailsVisibilityChanged;
/// <summary>
/// Occurs when the row has been successfully committed or canceled.
/// </summary>
public event EventHandler<DataGridRowEditEndedEventArgs> RowEditEnded;
/// <summary>
/// Occurs immediately before the row has been successfully committed or canceled.
/// </summary>
public event EventHandler<DataGridRowEditEndingEventArgs> RowEditEnding;
/// <summary>
/// Occurs when the <see cref="SelectedItem"/> or
/// <see cref="SelectedItems"/> property value changes.
/// </summary>
public event SelectionChangedEventHandler SelectionChanged;
/// <summary>
/// Occurs when the <see cref="Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumn"/> sorting request is triggered.
/// </summary>
public event EventHandler<DataGridColumnEventArgs> Sorting;
/// <summary>
/// Occurs when a <see cref="DataGridRow"/>
/// object becomes available for reuse.
/// </summary>
public event EventHandler<DataGridRowEventArgs> UnloadingRow;
/// <summary>
/// Occurs when the DataGridRowGroupHeader is available for reuse.
/// </summary>
public event EventHandler<DataGridRowGroupHeaderEventArgs> UnloadingRowGroup;
/// <summary>
/// Occurs when a row details element becomes available for reuse.
/// </summary>
public event EventHandler<DataGridRowDetailsEventArgs> UnloadingRowDetails;
/// <summary>
/// Initializes a new instance of the <see cref="DataGrid"/> class.
/// </summary>
public DataGrid()
{
this.TabNavigation = KeyboardNavigationMode.Once;
_loadedRows = new List<DataGridRow>();
_lostFocusActions = new Queue<Action>();
_selectedItems = new DataGridSelectedItemsCollection(this);
_rowGroupHeaderPropertyNameAlternative = Controls.Resources.DefaultRowGroupHeaderPropertyNameAlternative;
_rowGroupHeaderStyles = new ObservableCollection<Style>();
_rowGroupHeaderStyles.CollectionChanged += RowGroupHeaderStyles_CollectionChanged;
_rowGroupHeaderStylesOld = new List<Style>();
this.RowGroupHeadersTable = new IndexToValueTable<DataGridRowGroupInfo>();
_collapsedSlotsTable = new IndexToValueTable<Visibility>();
_validationItems = new Dictionary<INotifyDataErrorInfo, string>();
_validationResults = new List<ValidationResult>();
_bindingValidationResults = new List<ValidationResult>();
_propertyValidationResults = new List<ValidationResult>();
_indeiValidationResults = new List<ValidationResult>();
this.ColumnHeaderInteractionInfo = new DataGridColumnHeaderInteractionInfo();
this.DisplayData = new DataGridDisplayData(this);
this.ColumnsInternal = CreateColumnsInstance();
this.RowHeightEstimate = DATAGRID_defaultRowHeight;
this.RowDetailsHeightEstimate = 0;
_rowHeaderDesiredWidth = 0;
this.DataConnection = new DataGridDataConnection(this);
_showDetailsTable = new IndexToValueTable<Visibility>();
_focusInputDevice = FocusInputDeviceKind.None;
_proposedScrollBarsState = ScrollBarVisualState.NoIndicator;
_proposedScrollBarsSeparatorState = ScrollBarsSeparatorVisualState.SeparatorCollapsed;
this.AnchorSlot = -1;
_lastEstimatedRow = -1;
_editingColumnIndex = -1;
this.CurrentCellCoordinates = new DataGridCellCoordinates(-1, -1);
this.RowGroupHeaderHeightEstimate = DATAGRID_defaultRowHeight;
this.LastHandledKeyDown = VirtualKey.None;
this.DefaultStyleKey = typeof(DataGrid);
HookDataGridEvents();
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used to paint the background of odd-numbered rows.
/// </summary>
/// <returns>
/// The brush that is used to paint the background of odd-numbered rows.
/// </returns>
public Brush AlternatingRowBackground
{
get { return GetValue(AlternatingRowBackgroundProperty) as Brush; }
set { SetValue(AlternatingRowBackgroundProperty, value); }
}
/// <summary>
/// Identifies the <see cref="AlternatingRowBackground"/>
/// dependency property.
/// </summary>
/// <returns>
/// The identifier for the <see cref="AlternatingRowBackground"/>
/// dependency property.
/// </returns>
public static readonly DependencyProperty AlternatingRowBackgroundProperty =
DependencyProperty.Register(
"AlternatingRowBackground",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnAlternatingRowBackgroundPropertyChanged));
private static void OnAlternatingRowBackgroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureBackground();
}
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used to paint the foreground of odd-numbered rows.
/// </summary>
/// <returns>
/// The brush that is used to paint the foreground of odd-numbered rows.
/// </returns>
public Brush AlternatingRowForeground
{
get { return GetValue(AlternatingRowForegroundProperty) as Brush; }
set { SetValue(AlternatingRowForegroundProperty, value); }
}
/// <summary>
/// Identifies the <see cref="AlternatingRowForeground"/>
/// dependency property.
/// </summary>
/// <returns>
/// The identifier for the <see cref="AlternatingRowForeground"/>
/// dependency property.
/// </returns>
public static readonly DependencyProperty AlternatingRowForegroundProperty =
DependencyProperty.Register(
"AlternatingRowForeground",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnAlternatingRowForegroundPropertyChanged));
private static void OnAlternatingRowForegroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureForeground();
}
}
/// <summary>
/// Gets or sets a value indicating whether the row details sections remain
/// fixed at the width of the display area or can scroll horizontally.
/// </summary>
public bool AreRowDetailsFrozen
{
get { return (bool)GetValue(AreRowDetailsFrozenProperty); }
set { SetValue(AreRowDetailsFrozenProperty, value); }
}
/// <summary>
/// Identifies the AreRowDetailsFrozen dependency property.
/// </summary>
public static readonly DependencyProperty AreRowDetailsFrozenProperty =
DependencyProperty.Register(
"AreRowDetailsFrozen",
typeof(bool),
typeof(DataGrid),
null);
/// <summary>
/// Gets or sets a value indicating whether the row group header sections
/// remain fixed at the width of the display area or can scroll horizontally.
/// </summary>
public bool AreRowGroupHeadersFrozen
{
get { return (bool)GetValue(AreRowGroupHeadersFrozenProperty); }
set { SetValue(AreRowGroupHeadersFrozenProperty, value); }
}
/// <summary>
/// Identifies the AreRowDetailsFrozen dependency property.
/// </summary>
public static readonly DependencyProperty AreRowGroupHeadersFrozenProperty =
DependencyProperty.Register(
"AreRowGroupHeadersFrozen",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(true, OnAreRowGroupHeadersFrozenPropertyChanged));
private static void OnAreRowGroupHeadersFrozenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
ProcessFrozenColumnCount(dataGrid);
// Update elements in the RowGroupHeader that were previously frozen.
if ((bool)e.NewValue)
{
if (dataGrid._rowsPresenter != null)
{
foreach (UIElement element in dataGrid._rowsPresenter.Children)
{
DataGridRowGroupHeader groupHeader = element as DataGridRowGroupHeader;
if (groupHeader != null)
{
groupHeader.ClearFrozenStates();
}
}
}
}
}
/// <summary>
/// Gets or sets a value indicating whether columns are created
/// automatically when the <see cref="ItemsSource"/> property is set.
/// </summary>
public bool AutoGenerateColumns
{
get { return (bool)GetValue(AutoGenerateColumnsProperty); }
set { SetValue(AutoGenerateColumnsProperty, value); }
}
/// <summary>
/// Identifies the AutoGenerateColumns dependency property.
/// </summary>
public static readonly DependencyProperty AutoGenerateColumnsProperty =
DependencyProperty.Register(
"AutoGenerateColumns",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultAutoGenerateColumns, OnAutoGenerateColumnsPropertyChanged));
private static void OnAutoGenerateColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
bool value = (bool)e.NewValue;
if (value)
{
dataGrid.InitializeElements(false /*recycleRows*/);
}
else
{
dataGrid.RemoveAutoGeneratedColumns();
}
}
/// <summary>
/// Gets or sets a value indicating whether the user can change
/// the column display order by dragging column headers with the mouse.
/// </summary>
public bool CanUserReorderColumns
{
get { return (bool)GetValue(CanUserReorderColumnsProperty); }
set { SetValue(CanUserReorderColumnsProperty, value); }
}
/// <summary>
/// Identifies the CanUserReorderColumns dependency property.
/// </summary>
public static readonly DependencyProperty CanUserReorderColumnsProperty =
DependencyProperty.Register(
"CanUserReorderColumns",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultCanUserReorderColumns));
/// <summary>
/// Gets or sets a value indicating whether the user can adjust column widths using the mouse.
/// </summary>
public bool CanUserResizeColumns
{
get { return (bool)GetValue(CanUserResizeColumnsProperty); }
set { SetValue(CanUserResizeColumnsProperty, value); }
}
/// <summary>
/// Identifies the CanUserResizeColumns dependency property.
/// </summary>
public static readonly DependencyProperty CanUserResizeColumnsProperty =
DependencyProperty.Register(
"CanUserResizeColumns",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultCanUserResizeColumns, OnCanUserResizeColumnsPropertyChanged));
/// <summary>
/// CanUserResizeColumns property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its CanUserResizeColumns.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnCanUserResizeColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
dataGrid.EnsureHorizontalLayout();
}
/// <summary>
/// Gets or sets a value indicating whether the user can sort columns by clicking the column header.
/// </summary>
public bool CanUserSortColumns
{
get { return (bool)GetValue(CanUserSortColumnsProperty); }
set { SetValue(CanUserSortColumnsProperty, value); }
}
/// <summary>
/// Identifies the CanUserSortColumns dependency property.
/// </summary>
public static readonly DependencyProperty CanUserSortColumnsProperty =
DependencyProperty.Register(
"CanUserSortColumns",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultCanUserSortColumns));
/// <summary>
/// Gets or sets the style that is used when rendering the data grid cells.
/// </summary>
public Style CellStyle
{
get { return GetValue(CellStyleProperty) as Style; }
set { SetValue(CellStyleProperty, value); }
}
/// <summary>
/// Identifies the <see cref="CellStyle"/> dependency property.
/// </summary>
public static readonly DependencyProperty CellStyleProperty =
DependencyProperty.Register(
"CellStyle",
typeof(Style),
typeof(DataGrid),
new PropertyMetadata(null, OnCellStylePropertyChanged));
private static void OnCellStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (dataGrid != null)
{
Style previousStyle = e.OldValue as Style;
foreach (DataGridRow row in dataGrid.GetAllRows())
{
foreach (DataGridCell cell in row.Cells)
{
cell.EnsureStyle(previousStyle);
}
row.FillerCell.EnsureStyle(previousStyle);
}
dataGrid.InvalidateRowHeightEstimate();
}
}
/// <summary>
/// Gets or sets the property which determines how DataGrid content is copied to the Clipboard.
/// </summary>
public DataGridClipboardCopyMode ClipboardCopyMode
{
get { return (DataGridClipboardCopyMode)GetValue(ClipboardCopyModeProperty); }
set { SetValue(ClipboardCopyModeProperty, value); }
}
/// <summary>
/// Identifies the <see cref="ClipboardCopyMode"/> dependency property.
/// </summary>
public static readonly DependencyProperty ClipboardCopyModeProperty =
DependencyProperty.Register(
"ClipboardCopyMode",
typeof(DataGridClipboardCopyMode),
typeof(DataGrid),
new PropertyMetadata(DataGridClipboardCopyMode.ExcludeHeader));
/// <summary>
/// Gets or sets the height of the column headers row.
/// </summary>
public double ColumnHeaderHeight
{
get { return (double)GetValue(ColumnHeaderHeightProperty); }
set { SetValue(ColumnHeaderHeightProperty, value); }
}
/// <summary>
/// Identifies the ColumnHeaderHeight dependency property.
/// </summary>
public static readonly DependencyProperty ColumnHeaderHeightProperty =
DependencyProperty.Register(
"ColumnHeaderHeight",
typeof(double),
typeof(DataGrid),
new PropertyMetadata(double.NaN, OnColumnHeaderHeightPropertyChanged));
/// <summary>
/// ColumnHeaderHeightProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its ColumnHeaderHeight.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnColumnHeaderHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double value = (double)e.NewValue;
if (value < DATAGRID_minimumColumnHeaderHeight)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "ColumnHeaderHeight", DATAGRID_minimumColumnHeaderHeight);
}
if (value > DATAGRID_maxHeadersThickness)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeLessThanOrEqualTo("value", "ColumnHeaderHeight", DATAGRID_maxHeadersThickness);
}
dataGrid.InvalidateMeasure();
}
}
/// <summary>
/// Gets or sets the style that is used when rendering the column headers.
/// </summary>
public Style ColumnHeaderStyle
{
get { return GetValue(ColumnHeaderStyleProperty) as Style; }
set { SetValue(ColumnHeaderStyleProperty, value); }
}
/// <summary>
/// Identifies the ColumnHeaderStyle dependency property.
/// </summary>
public static readonly DependencyProperty ColumnHeaderStyleProperty =
DependencyProperty.Register(
"ColumnHeaderStyle",
typeof(Style),
typeof(DataGrid),
new PropertyMetadata(null, OnColumnHeaderStylePropertyChanged));
private static void OnColumnHeaderStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// TODO: ColumnHeaderStyle should be applied to the TopLeftCorner and the TopRightCorner as well
DataGrid dataGrid = d as DataGrid;
if (dataGrid != null)
{
Style previousStyle = e.OldValue as Style;
foreach (DataGridColumn column in dataGrid.Columns)
{
column.HeaderCell.EnsureStyle(previousStyle);
}
if (dataGrid.ColumnsInternal.FillerColumn != null)
{
dataGrid.ColumnsInternal.FillerColumn.HeaderCell.EnsureStyle(previousStyle);
}
}
}
/// <summary>
/// Gets or sets the standard width or automatic sizing mode of columns in the control.
/// </summary>
public DataGridLength ColumnWidth
{
get { return (DataGridLength)GetValue(ColumnWidthProperty); }
set { SetValue(ColumnWidthProperty, value); }
}
/// <summary>
/// Identifies the ColumnWidth dependency property.
/// </summary>
public static readonly DependencyProperty ColumnWidthProperty =
DependencyProperty.Register(
"ColumnWidth",
typeof(DataGridLength),
typeof(DataGrid),
new PropertyMetadata(DataGridLength.Auto, OnColumnWidthPropertyChanged));
/// <summary>
/// ColumnWidthProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its ColumnWidth.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnColumnWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
foreach (DataGridColumn column in dataGrid.ColumnsInternal.GetDisplayedColumns())
{
if (column.InheritsWidth)
{
column.SetWidthInternalNoCallback(dataGrid.ColumnWidth);
}
}
dataGrid.EnsureHorizontalLayout();
}
/// <summary>
/// Gets or sets the amount of data to fetch for virtualizing/prefetch operations.
/// </summary>
/// <returns>
/// The amount of data to fetch per interval, in pages.
/// </returns>
public double DataFetchSize
{
get { return (double)GetValue(DataFetchSizeProperty); }
set { SetValue(DataFetchSizeProperty, value); }
}
/// <summary>
/// Identifies the <see cref="DataFetchSize"/> dependency property
/// </summary>
public static readonly DependencyProperty DataFetchSizeProperty =
DependencyProperty.Register(
nameof(DataFetchSize),
typeof(double),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultDataFetchSize, OnDataFetchSizePropertyChanged));
/// <summary>
/// DataFetchSizeProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its DataFetchSize.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnDataFetchSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double oldValue = (double)e.OldValue;
double newValue = (double)e.NewValue;
if (double.IsNaN(newValue))
{
dataGrid.SetValueNoCallback(e.Property, oldValue);
throw DataGridError.DataGrid.ValueCannotBeSetToNAN(nameof(dataGrid.DataFetchSize));
}
if (newValue < 0)
{
dataGrid.SetValueNoCallback(e.Property, oldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", nameof(dataGrid.DataFetchSize), 0);
}
}
}
/// <summary>
/// Gets or sets the style that is used when rendering the drag indicator
/// that is displayed while dragging column headers.
/// </summary>
public Style DragIndicatorStyle
{
get { return GetValue(DragIndicatorStyleProperty) as Style; }
set { SetValue(DragIndicatorStyleProperty, value); }
}
/// <summary>
/// Identifies the <see cref="DragIndicatorStyle"/>
/// dependency property.
/// </summary>
public static readonly DependencyProperty DragIndicatorStyleProperty =
DependencyProperty.Register(
"DragIndicatorStyle",
typeof(Style),
typeof(DataGrid),
null);
/// <summary>
/// Gets or sets the style that is used when rendering the column headers.
/// </summary>
public Style DropLocationIndicatorStyle
{
get { return GetValue(DropLocationIndicatorStyleProperty) as Style; }
set { SetValue(DropLocationIndicatorStyleProperty, value); }
}
/// <summary>
/// Identifies the <see cref="DropLocationIndicatorStyle"/>
/// dependency property.
/// </summary>
public static readonly DependencyProperty DropLocationIndicatorStyleProperty =
DependencyProperty.Register(
"DropLocationIndicatorStyle",
typeof(Style),
typeof(DataGrid),
null);
/// <summary>
/// Gets or sets the number of columns that the user cannot scroll horizontally.
/// </summary>
public int FrozenColumnCount
{
get { return (int)GetValue(FrozenColumnCountProperty); }
set { SetValue(FrozenColumnCountProperty, value); }
}
/// <summary>
/// Identifies the <see cref="FrozenColumnCount"/>
/// dependency property.
/// </summary>
public static readonly DependencyProperty FrozenColumnCountProperty =
DependencyProperty.Register(
"FrozenColumnCount",
typeof(int),
typeof(DataGrid),
new PropertyMetadata(0, OnFrozenColumnCountPropertyChanged));
private static void OnFrozenColumnCountPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
if ((int)e.NewValue < 0)
{
dataGrid.SetValueNoCallback(DataGrid.FrozenColumnCountProperty, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "FrozenColumnCount", 0);
}
ProcessFrozenColumnCount(dataGrid);
}
}
private static void ProcessFrozenColumnCount(DataGrid dataGrid)
{
dataGrid.CorrectColumnFrozenStates();
dataGrid.ComputeScrollBarsLayout();
dataGrid.InvalidateColumnHeadersArrange();
dataGrid.InvalidateCellsArrange();
}
/// <summary>
/// Gets or sets a value indicating which grid lines separating inner cells are shown.
/// </summary>
public DataGridGridLinesVisibility GridLinesVisibility
{
get { return (DataGridGridLinesVisibility)GetValue(GridLinesVisibilityProperty); }
set { SetValue(GridLinesVisibilityProperty, value); }
}
/// <summary>
/// Identifies the GridLinesVisibility dependency property.
/// </summary>
public static readonly DependencyProperty GridLinesVisibilityProperty =
DependencyProperty.Register(
"GridLinesVisibility",
typeof(DataGridGridLinesVisibility),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultGridLinesVisibility, OnGridLinesVisibilityPropertyChanged));
/// <summary>
/// GridLinesProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its GridLines.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnGridLinesVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureGridLines();
row.InvalidateHorizontalArrange();
}
foreach (DataGridRowGroupHeader rowGroupHeader in dataGrid.GetAllRowGroupHeaders())
{
rowGroupHeader.EnsureGridLine();
}
}
/// <summary>
/// Gets or sets a value indicating the visibility of row and column headers.
/// </summary>
public DataGridHeadersVisibility HeadersVisibility
{
get { return (DataGridHeadersVisibility)GetValue(HeadersVisibilityProperty); }
set { SetValue(HeadersVisibilityProperty, value); }
}
/// <summary>
/// Identifies the HeadersVisibility dependency property.
/// </summary>
public static readonly DependencyProperty HeadersVisibilityProperty =
DependencyProperty.Register(
"HeadersVisibility",
typeof(DataGridHeadersVisibility),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultHeadersVisibility, OnHeadersVisibilityPropertyChanged));
/// <summary>
/// HeadersVisibilityProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its HeadersVisibility.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnHeadersVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
DataGridHeadersVisibility newValue = (DataGridHeadersVisibility)e.NewValue;
DataGridHeadersVisibility oldValue = (DataGridHeadersVisibility)e.OldValue;
Func<DataGridHeadersVisibility, DataGridHeadersVisibility, bool> hasFlags = (DataGridHeadersVisibility value, DataGridHeadersVisibility flags) => ((value & flags) == flags);
bool newValueCols = hasFlags(newValue, DataGridHeadersVisibility.Column);
bool newValueRows = hasFlags(newValue, DataGridHeadersVisibility.Row);
bool oldValueCols = hasFlags(oldValue, DataGridHeadersVisibility.Column);
bool oldValueRows = hasFlags(oldValue, DataGridHeadersVisibility.Row);
// Columns
if (newValueCols != oldValueCols)
{
if (dataGrid._columnHeadersPresenter != null)
{
dataGrid.EnsureColumnHeadersVisibility();
if (!newValueCols)
{
dataGrid._columnHeadersPresenter.Measure(new Size(0.0, 0.0));
}
else
{
dataGrid.EnsureVerticalGridLines();
}
dataGrid.InvalidateMeasure();
}
}
// Rows
if (newValueRows != oldValueRows && dataGrid._rowsPresenter != null)
{
foreach (FrameworkElement element in dataGrid._rowsPresenter.Children)
{
DataGridRow row = element as DataGridRow;
if (row != null)
{
row.EnsureHeaderStyleAndVisibility(null);
if (newValueRows)
{
row.ApplyState(false /*animate*/);
row.EnsureHeaderVisibility();
}
}
else
{
DataGridRowGroupHeader rowGroupHeader = element as DataGridRowGroupHeader;
if (rowGroupHeader != null)
{
rowGroupHeader.EnsureHeaderStyleAndVisibility(null);
}
}
}
dataGrid.InvalidateRowHeightEstimate();
dataGrid.InvalidateRowsMeasure(true /*invalidateIndividualElements*/);
}
// TODO: This isn't necessary if the TopLeftCorner and the TopRightCorner Autosize to 0.
// See if their templates can be changed to do that.
if (dataGrid._topLeftCornerHeader != null)
{
dataGrid._topLeftCornerHeader.Visibility = (newValueRows && newValueCols) ? Visibility.Visible : Visibility.Collapsed;
if (dataGrid._topLeftCornerHeader.Visibility == Visibility.Collapsed)
{
dataGrid._topLeftCornerHeader.Measure(new Size(0.0, 0.0));
}
}
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used to paint grid lines separating rows.
/// </summary>
public Brush HorizontalGridLinesBrush
{
get { return GetValue(HorizontalGridLinesBrushProperty) as Brush; }
set { SetValue(HorizontalGridLinesBrushProperty, value); }
}
/// <summary>
/// Identifies the HorizontalGridLinesBrush dependency property.
/// </summary>
public static readonly DependencyProperty HorizontalGridLinesBrushProperty =
DependencyProperty.Register(
"HorizontalGridLinesBrush",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnHorizontalGridLinesBrushPropertyChanged));
/// <summary>
/// HorizontalGridLinesBrushProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its HorizontalGridLinesBrush.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnHorizontalGridLinesBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property) && dataGrid._rowsPresenter != null)
{
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureGridLines();
}
foreach (DataGridRowGroupHeader rowGroupHeader in dataGrid.GetAllRowGroupHeaders())
{
rowGroupHeader.EnsureGridLine();
}
}
}
/// <summary>
/// Gets or sets a value indicating how the horizontal scroll bar is displayed.
/// </summary>
public ScrollBarVisibility HorizontalScrollBarVisibility
{
get { return (ScrollBarVisibility)GetValue(HorizontalScrollBarVisibilityProperty); }
set { SetValue(HorizontalScrollBarVisibilityProperty, value); }
}
/// <summary>
/// Identifies the HorizontalScrollBarVisibility dependency property.
/// </summary>
public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty =
DependencyProperty.Register(
"HorizontalScrollBarVisibility",
typeof(ScrollBarVisibility),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultScrollBarVisibility, OnHorizontalScrollBarVisibilityPropertyChanged));
/// <summary>
/// HorizontalScrollBarVisibilityProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its HorizontalScrollBarVisibility.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnHorizontalScrollBarVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property) && (ScrollBarVisibility)e.NewValue != (ScrollBarVisibility)e.OldValue)
{
dataGrid.UpdateRowsPresenterManipulationMode(true /*horizontalMode*/, false /*verticalMode*/);
if (dataGrid._hScrollBar != null)
{
if (dataGrid.IsHorizontalScrollBarOverCells)
{
dataGrid.ComputeScrollBarsLayout();
}
else
{
dataGrid.InvalidateMeasure();
}
}
}
}
/// <summary>
/// Gets or sets a value indicating whether the user can edit the values in the control.
/// </summary>
public bool IsReadOnly
{
get { return (bool)GetValue(IsReadOnlyProperty); }
set { SetValue(IsReadOnlyProperty, value); }
}
/// <summary>
/// Identifies the IsReadOnly dependency property.
/// </summary>
public static readonly DependencyProperty IsReadOnlyProperty =
DependencyProperty.Register(
"IsReadOnly",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(false, OnIsReadOnlyPropertyChanged));
/// <summary>
/// IsReadOnlyProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its IsReadOnly.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnIsReadOnlyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
bool value = (bool)e.NewValue;
if (value && !dataGrid.CommitEdit(DataGridEditingUnit.Row, true /*exitEditing*/))
{
dataGrid.CancelEdit(DataGridEditingUnit.Row, false /*raiseEvents*/);
}
#if FEATURE_IEDITABLECOLLECTIONVIEW
dataGrid.UpdateNewItemPlaceholder();
#endif
}
}
/// <summary>
/// Gets a value indicating whether data in the grid is valid.
/// </summary>
public bool IsValid
{
get
{
return (bool)GetValue(IsValidProperty);
}
internal set
{
if (value != this.IsValid)
{
if (value)
{
VisualStates.GoToState(this, true, VisualStates.StateValid);
}
else
{
VisualStates.GoToState(this, true, VisualStates.StateInvalid, VisualStates.StateValid);
}
this.SetValueNoCallback(DataGrid.IsValidProperty, value);
}
}
}
/// <summary>
/// Identifies the IsValid dependency property.
/// </summary>
public static readonly DependencyProperty IsValidProperty =
DependencyProperty.Register(
"IsValid",
typeof(bool),
typeof(DataGrid),
new PropertyMetadata(true, OnIsValidPropertyChanged));
/// <summary>
/// IsValidProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its IsValid.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnIsValidPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
dataGrid.SetValueNoCallback(DataGrid.IsValidProperty, e.OldValue);
throw DataGridError.DataGrid.UnderlyingPropertyIsReadOnly("IsValid");
}
}
/// <summary>
/// Gets or sets the threshold range that governs when the DataGrid class will begin to prefetch more items.
/// </summary>
/// <returns>
/// The loading threshold, in terms of pages.
/// </returns>
public double IncrementalLoadingThreshold
{
get { return (double)GetValue(IncrementalLoadingThresholdProperty); }
set { SetValue(IncrementalLoadingThresholdProperty, value); }
}
/// <summary>
/// Identifies the <see cref="IncrementalLoadingThreshold"/> dependency property
/// </summary>
public static readonly DependencyProperty IncrementalLoadingThresholdProperty =
DependencyProperty.Register(
nameof(IncrementalLoadingThreshold),
typeof(double),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultIncrementalLoadingThreshold, OnIncrementalLoadingThresholdPropertyChanged));
/// <summary>
/// IncrementalLoadingThresholdProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its IncrementalLoadingThreshold.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnIncrementalLoadingThresholdPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double oldValue = (double)e.OldValue;
double newValue = (double)e.NewValue;
if (double.IsNaN(newValue))
{
dataGrid.SetValueNoCallback(e.Property, oldValue);
throw DataGridError.DataGrid.ValueCannotBeSetToNAN(nameof(dataGrid.IncrementalLoadingThreshold));
}
if (newValue < 0)
{
dataGrid.SetValueNoCallback(e.Property, oldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", nameof(dataGrid.IncrementalLoadingThreshold), 0);
}
if (newValue > oldValue)
{
dataGrid.LoadMoreDataFromIncrementalItemsSource();
}
}
}
/// <summary>
/// Gets or sets a value that indicates the conditions for prefetch operations by the DataGrid class.
/// </summary>
/// <returns>
/// An enumeration value that indicates the conditions that trigger prefetch operations. The default is **Edge**.
/// </returns>
public IncrementalLoadingTrigger IncrementalLoadingTrigger
{
get { return (IncrementalLoadingTrigger)GetValue(IncrementalLoadingTriggerProperty); }
set { SetValue(IncrementalLoadingTriggerProperty, value); }
}
/// <summary>
/// Identifies the <see cref="IncrementalLoadingTrigger"/> dependency property
/// </summary>
public static readonly DependencyProperty IncrementalLoadingTriggerProperty =
DependencyProperty.Register(
nameof(IncrementalLoadingTrigger),
typeof(IncrementalLoadingTrigger),
typeof(DataGrid),
new PropertyMetadata(IncrementalLoadingTrigger.Edge));
/// <summary>
/// Gets or sets a collection that is used to generate the content of the control.
/// </summary>
public IEnumerable ItemsSource
{
get { return GetValue(ItemsSourceProperty) as IEnumerable; }
set { SetValue(ItemsSourceProperty, value); }
}
/// <summary>
/// Identifies the <see cref="ItemsSource"/> dependency property.
/// </summary>
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register(
"ItemsSource",
typeof(IEnumerable),
typeof(DataGrid),
new PropertyMetadata(null, OnItemsSourcePropertyChanged));
/// <summary>
/// ItemsSourceProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its ItemsSource.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnItemsSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
DiagnosticsDebug.Assert(dataGrid.DataConnection != null, "Expected non-null DataConnection.");
if (dataGrid.LoadingOrUnloadingRow)
{
dataGrid.SetValueNoCallback(DataGrid.ItemsSourceProperty, e.OldValue);
throw DataGridError.DataGrid.CannotChangeItemsWhenLoadingRows();
}
// Try to commit edit on the old DataSource, but force a cancel if it fails.
if (!dataGrid.CommitEdit())
{
dataGrid.CancelEdit(DataGridEditingUnit.Row, false);
}
dataGrid.DataConnection.UnWireEvents(dataGrid.DataConnection.DataSource);
dataGrid.DataConnection.ClearDataProperties();
dataGrid.ClearRowGroupHeadersTable();
// The old selected indexes are no longer relevant. There's a perf benefit from
// updating the selected indexes with a null DataSource, because we know that all
// of the previously selected indexes have been removed from selection.
dataGrid.DataConnection.DataSource = null;
dataGrid._selectedItems.UpdateIndexes();
dataGrid.CoerceSelectedItem();
// Wrap an IEnumerable in an ICollectionView if it's not already one.
bool setDefaultSelection = false;
IEnumerable newItemsSource = e.NewValue as IEnumerable;
if (newItemsSource != null && !(newItemsSource is ICollectionView))
{
dataGrid.DataConnection.DataSource = DataGridDataConnection.CreateView(newItemsSource);
}
else
{
dataGrid.DataConnection.DataSource = newItemsSource;
setDefaultSelection = true;
}
if (dataGrid.DataConnection.DataSource != null)
{
// Setup the column headers.
if (dataGrid.DataConnection.DataType != null)
{
foreach (DataGridBoundColumn boundColumn in dataGrid.ColumnsInternal.GetDisplayedColumns(column => column is DataGridBoundColumn))
{
boundColumn.SetHeaderFromBinding();
}
}
dataGrid.DataConnection.WireEvents(dataGrid.DataConnection.DataSource);
}
// Wait for the current cell to be set before we raise any SelectionChanged events.
dataGrid._makeFirstDisplayedCellCurrentCellPending = true;
// Clear out the old rows and remove the generated columns.
dataGrid.ClearRows(false /*recycle*/);
dataGrid.RemoveAutoGeneratedColumns();
// Set the SlotCount (from the data count and number of row group headers) before we make the default selection.
dataGrid.PopulateRowGroupHeadersTable();
dataGrid.RefreshSlotCounts();
dataGrid.SelectedItem = null;
if (dataGrid.DataConnection.CollectionView != null && setDefaultSelection)
{
dataGrid.SelectedItem = dataGrid.DataConnection.CollectionView.CurrentItem;
}
// Treat this like the DataGrid has never been measured because all calculations at
// this point are invalid until the next layout cycle. For instance, the ItemsSource
// can be set when the DataGrid is not part of the visual tree.
dataGrid._measured = false;
dataGrid.InvalidateMeasure();
}
}
/// <summary>
/// Gets or sets the maximum width of columns in the <see cref="DataGrid"/>.
/// </summary>
public double MaxColumnWidth
{
get { return (double)GetValue(MaxColumnWidthProperty); }
set { SetValue(MaxColumnWidthProperty, value); }
}
/// <summary>
/// Identifies the MaxColumnWidth dependency property.
/// </summary>
public static readonly DependencyProperty MaxColumnWidthProperty =
DependencyProperty.Register(
"MaxColumnWidth",
typeof(double),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultMaxColumnWidth, OnMaxColumnWidthPropertyChanged));
/// <summary>
/// MaxColumnWidthProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its ColumnWidth.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnMaxColumnWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double oldValue = (double)e.OldValue;
double newValue = (double)e.NewValue;
if (double.IsNaN(newValue))
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueCannotBeSetToNAN("MaxColumnWidth");
}
if (newValue < 0)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "MaxColumnWidth", 0);
}
if (dataGrid.MinColumnWidth > newValue)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "MaxColumnWidth", "MinColumnWidth");
}
foreach (DataGridColumn column in dataGrid.ColumnsInternal.GetDisplayedColumns())
{
dataGrid.OnColumnMaxWidthChanged(column, Math.Min(column.MaxWidth, oldValue));
}
}
}
/// <summary>
/// Gets or sets the minimum width of columns in the <see cref="DataGrid"/>.
/// </summary>
public double MinColumnWidth
{
get { return (double)GetValue(MinColumnWidthProperty); }
set { SetValue(MinColumnWidthProperty, value); }
}
/// <summary>
/// Identifies the MinColumnWidth dependency property.
/// </summary>
public static readonly DependencyProperty MinColumnWidthProperty =
DependencyProperty.Register(
"MinColumnWidth",
typeof(double),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultMinColumnWidth, OnMinColumnWidthPropertyChanged));
/// <summary>
/// MinColumnWidthProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its ColumnWidth.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnMinColumnWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double oldValue = (double)e.OldValue;
double newValue = (double)e.NewValue;
if (double.IsNaN(newValue))
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueCannotBeSetToNAN("MinColumnWidth");
}
if (newValue < 0)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "MinColumnWidth", 0);
}
if (double.IsPositiveInfinity(newValue))
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueCannotBeSetToInfinity("MinColumnWidth");
}
if (dataGrid.MaxColumnWidth < newValue)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeLessThanOrEqualTo("value", "MinColumnWidth", "MaxColumnWidth");
}
foreach (DataGridColumn column in dataGrid.ColumnsInternal.GetDisplayedColumns())
{
dataGrid.OnColumnMinWidthChanged(column, Math.Max(column.MinWidth, oldValue));
}
}
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used to paint row backgrounds.
/// </summary>
public Brush RowBackground
{
get { return GetValue(RowBackgroundProperty) as Brush; }
set { SetValue(RowBackgroundProperty, value); }
}
/// <summary>
/// Identifies the <see cref="RowBackground"/> dependency property.
/// </summary>
public static readonly DependencyProperty RowBackgroundProperty =
DependencyProperty.Register(
"RowBackground",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnRowBackgroundPropertyChanged));
private static void OnRowBackgroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
// Go through the Displayed rows and update the background
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureBackground();
}
}
/// <summary>
/// Gets or sets the template that is used to display the content of the details section of rows.
/// </summary>
public DataTemplate RowDetailsTemplate
{
get { return GetValue(RowDetailsTemplateProperty) as DataTemplate; }
set { SetValue(RowDetailsTemplateProperty, value); }
}
/// <summary>
/// Identifies the RowDetailsTemplate dependency property.
/// </summary>
public static readonly DependencyProperty RowDetailsTemplateProperty =
DependencyProperty.Register(
"RowDetailsTemplate",
typeof(DataTemplate),
typeof(DataGrid),
new PropertyMetadata(null, OnRowDetailsTemplatePropertyChanged));
private static void OnRowDetailsTemplatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
// Update the RowDetails templates if necessary
if (dataGrid._rowsPresenter != null)
{
foreach (DataGridRow row in dataGrid.GetAllRows())
{
if (dataGrid.GetRowDetailsVisibility(row.Index) == Visibility.Visible)
{
// DetailsPreferredHeight is initialized when the DetailsElement's size changes.
row.ApplyDetailsTemplate(false /*initializeDetailsPreferredHeight*/);
}
}
}
dataGrid.UpdateRowDetailsHeightEstimate();
dataGrid.InvalidateMeasure();
}
/// <summary>
/// Gets or sets a value indicating when the details sections of rows are displayed.
/// </summary>
public DataGridRowDetailsVisibilityMode RowDetailsVisibilityMode
{
get { return (DataGridRowDetailsVisibilityMode)GetValue(RowDetailsVisibilityModeProperty); }
set { SetValue(RowDetailsVisibilityModeProperty, value); }
}
/// <summary>
/// Identifies the RowDetailsVisibilityMode dependency property.
/// </summary>
public static readonly DependencyProperty RowDetailsVisibilityModeProperty =
DependencyProperty.Register(
"RowDetailsVisibilityMode",
typeof(DataGridRowDetailsVisibilityMode),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultRowDetailsVisibility, OnRowDetailsVisibilityModePropertyChanged));
/// <summary>
/// RowDetailsVisibilityModeProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its RowDetailsVisibilityMode.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnRowDetailsVisibilityModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
dataGrid.UpdateRowDetailsVisibilityMode((DataGridRowDetailsVisibilityMode)e.NewValue);
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used as the default cells foreground.
/// </summary>
public Brush RowForeground
{
get { return GetValue(RowForegroundProperty) as Brush; }
set { SetValue(RowForegroundProperty, value); }
}
/// <summary>
/// Identifies the <see cref="RowForeground"/> dependency property.
/// </summary>
public static readonly DependencyProperty RowForegroundProperty =
DependencyProperty.Register(
"RowForeground",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnRowForegroundPropertyChanged));
private static void OnRowForegroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
// Go through the Displayed rows and update the foreground
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureForeground();
}
}
/// <summary>
/// Gets or sets the standard height of rows in the control.
/// </summary>
public double RowHeight
{
get { return (double)GetValue(RowHeightProperty); }
set { SetValue(RowHeightProperty, value); }
}
/// <summary>
/// Identifies the RowHeight dependency property.
/// </summary>
public static readonly DependencyProperty RowHeightProperty =
DependencyProperty.Register(
"RowHeight",
typeof(double),
typeof(DataGrid),
new PropertyMetadata(double.NaN, OnRowHeightPropertyChanged));
/// <summary>
/// RowHeightProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its RowHeight.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnRowHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double value = (double)e.NewValue;
if (value < DataGridRow.DATAGRIDROW_minimumHeight)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "RowHeight", 0);
}
if (value > DataGridRow.DATAGRIDROW_maximumHeight)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeLessThanOrEqualTo("value", "RowHeight", DataGridRow.DATAGRIDROW_maximumHeight);
}
dataGrid.InvalidateRowHeightEstimate();
// Re-measure all the rows due to the Height change
dataGrid.InvalidateRowsMeasure(true);
// DataGrid needs to update the layout information and the ScrollBars
dataGrid.InvalidateMeasure();
}
}
/// <summary>
/// Gets or sets the width of the row header column.
/// </summary>
public double RowHeaderWidth
{
get { return (double)GetValue(RowHeaderWidthProperty); }
set { SetValue(RowHeaderWidthProperty, value); }
}
/// <summary>
/// Identifies the RowHeaderWidth dependency property.
/// </summary>
public static readonly DependencyProperty RowHeaderWidthProperty =
DependencyProperty.Register(
"RowHeaderWidth",
typeof(double),
typeof(DataGrid),
new PropertyMetadata(double.NaN, OnRowHeaderWidthPropertyChanged));
/// <summary>
/// RowHeaderWidthProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its RowHeaderWidth.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnRowHeaderWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
double value = (double)e.NewValue;
if (value < DATAGRID_minimumRowHeaderWidth)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeGreaterThanOrEqualTo("value", "RowHeaderWidth", DATAGRID_minimumRowHeaderWidth);
}
if (value > DATAGRID_maxHeadersThickness)
{
dataGrid.SetValueNoCallback(e.Property, e.OldValue);
throw DataGridError.DataGrid.ValueMustBeLessThanOrEqualTo("value", "RowHeaderWidth", DATAGRID_maxHeadersThickness);
}
dataGrid.EnsureRowHeaderWidth();
}
}
/// <summary>
/// Gets or sets the style that is used when rendering the row headers.
/// </summary>
public Style RowHeaderStyle
{
get { return GetValue(RowHeaderStyleProperty) as Style; }
set { SetValue(RowHeaderStyleProperty, value); }
}
/// <summary>
/// Identifies the <see cref="RowHeaderStyle"/> dependency property.
/// </summary>
public static readonly DependencyProperty RowHeaderStyleProperty =
DependencyProperty.Register(
"RowHeaderStyle",
typeof(Style),
typeof(DataGrid),
new PropertyMetadata(null, OnRowHeaderStylePropertyChanged));
private static void OnRowHeaderStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (dataGrid != null && dataGrid._rowsPresenter != null)
{
// Set HeaderStyle for displayed rows
Style previousStyle = e.OldValue as Style;
foreach (UIElement element in dataGrid._rowsPresenter.Children)
{
DataGridRow row = element as DataGridRow;
if (row != null)
{
row.EnsureHeaderStyleAndVisibility(previousStyle);
}
else
{
DataGridRowGroupHeader groupHeader = element as DataGridRowGroupHeader;
if (groupHeader != null)
{
groupHeader.EnsureHeaderStyleAndVisibility(previousStyle);
}
}
}
dataGrid.InvalidateRowHeightEstimate();
}
}
/// <summary>
/// Gets or sets the style that is used when rendering the rows.
/// </summary>
public Style RowStyle
{
get { return GetValue(RowStyleProperty) as Style; }
set { SetValue(RowStyleProperty, value); }
}
/// <summary>
/// Identifies the <see cref="RowStyle"/> dependency property.
/// </summary>
public static readonly DependencyProperty RowStyleProperty =
DependencyProperty.Register(
"RowStyle",
typeof(Style),
typeof(DataGrid),
new PropertyMetadata(null, OnRowStylePropertyChanged));
private static void OnRowStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (dataGrid != null)
{
if (dataGrid._rowsPresenter != null)
{
// Set the style for displayed rows if it has not already been set
foreach (DataGridRow row in dataGrid.GetAllRows())
{
EnsureElementStyle(row, e.OldValue as Style, e.NewValue as Style);
}
}
dataGrid.InvalidateRowHeightEstimate();
}
}
/// <summary>
/// Gets or sets the selection behavior of the data grid.
/// </summary>
public DataGridSelectionMode SelectionMode
{
get { return (DataGridSelectionMode)GetValue(SelectionModeProperty); }
set { SetValue(SelectionModeProperty, value); }
}
/// <summary>
/// Identifies the SelectionMode dependency property.
/// </summary>
public static readonly DependencyProperty SelectionModeProperty =
DependencyProperty.Register(
"SelectionMode",
typeof(DataGridSelectionMode),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultSelectionMode, OnSelectionModePropertyChanged));
/// <summary>
/// SelectionModeProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its SelectionMode.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnSelectionModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
dataGrid.ClearRowSelection(true /*resetAnchorSlot*/);
}
}
/// <summary>
/// Gets or sets the index of the current selection.
/// </summary>
/// <returns>The index of the current selection, or -1 if the selection is empty.</returns>
public int SelectedIndex
{
get { return (int)GetValue(SelectedIndexProperty); }
set { SetValue(SelectedIndexProperty, value); }
}
/// <summary>
/// Identifies the SelectedIndex dependency property.
/// </summary>
public static readonly DependencyProperty SelectedIndexProperty =
DependencyProperty.Register(
"SelectedIndex",
typeof(int),
typeof(DataGrid),
new PropertyMetadata(-1, OnSelectedIndexPropertyChanged));
/// <summary>
/// SelectedIndexProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its SelectedIndex.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnSelectedIndexPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
int index = (int)e.NewValue;
// GetDataItem returns null if index is >= Count, we do not check newValue
// against Count here to avoid enumerating through an Enumerable twice
// Setting SelectedItem coerces the finally value of the SelectedIndex
object newSelectedItem = (index < 0) ? null : dataGrid.DataConnection.GetDataItem(index);
dataGrid.SelectedItem = newSelectedItem;
if (dataGrid.SelectedItem != newSelectedItem)
{
d.SetValueNoCallback(e.Property, e.OldValue);
}
}
}
/// <summary>
/// Gets or sets the data item corresponding to the selected row.
/// </summary>
public object SelectedItem
{
get { return GetValue(SelectedItemProperty) as object; }
set { SetValue(SelectedItemProperty, value); }
}
/// <summary>
/// Identifies the SelectedItem dependency property.
/// </summary>
public static readonly DependencyProperty SelectedItemProperty =
DependencyProperty.Register(
"SelectedItem",
typeof(object),
typeof(DataGrid),
new PropertyMetadata(null, OnSelectedItemPropertyChanged));
/// <summary>
/// SelectedItemProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its SelectedItem.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnSelectedItemPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property))
{
int rowIndex = (e.NewValue == null) ? -1 : dataGrid.DataConnection.IndexOf(e.NewValue);
if (rowIndex == -1)
{
// If the Item is null or it's not found, clear the Selection
if (!dataGrid.CommitEdit(DataGridEditingUnit.Row, true /*exitEditing*/))
{
// Edited value couldn't be committed or aborted
d.SetValueNoCallback(e.Property, e.OldValue);
return;
}
// Clear all row selections
dataGrid.ClearRowSelection(true /*resetAnchorSlot*/);
}
else
{
int slot = dataGrid.SlotFromRowIndex(rowIndex);
if (slot != dataGrid.CurrentSlot)
{
if (!dataGrid.CommitEdit(DataGridEditingUnit.Row, true /*exitEditing*/))
{
// Edited value couldn't be committed or aborted
d.SetValueNoCallback(e.Property, e.OldValue);
return;
}
if (slot >= dataGrid.SlotCount || slot < -1)
{
if (dataGrid.DataConnection.CollectionView != null)
{
dataGrid.DataConnection.CollectionView.MoveCurrentToPosition(rowIndex);
}
}
}
int oldSelectedIndex = dataGrid.SelectedIndex;
if (oldSelectedIndex != rowIndex)
{
dataGrid.SetValueNoCallback(DataGrid.SelectedIndexProperty, rowIndex);
}
try
{
dataGrid._noSelectionChangeCount++;
int columnIndex = dataGrid.CurrentColumnIndex;
if (columnIndex == -1)
{
columnIndex = dataGrid.FirstDisplayedNonFillerColumnIndex;
}
if (dataGrid.IsSlotOutOfSelectionBounds(slot))
{
dataGrid.ClearRowSelection(slot /*slotException*/, true /*resetAnchorSlot*/);
return;
}
dataGrid.UpdateSelectionAndCurrency(columnIndex, slot, DataGridSelectionAction.SelectCurrent, false /*scrollIntoView*/);
}
finally
{
dataGrid.NoSelectionChangeCount--;
}
if (!dataGrid._successfullyUpdatedSelection)
{
dataGrid.SetValueNoCallback(DataGrid.SelectedIndexProperty, oldSelectedIndex);
d.SetValueNoCallback(e.Property, e.OldValue);
}
}
}
}
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush"/> that is used to paint grid lines separating columns.
/// </summary>
public Brush VerticalGridLinesBrush
{
get { return GetValue(VerticalGridLinesBrushProperty) as Brush; }
set { SetValue(VerticalGridLinesBrushProperty, value); }
}
/// <summary>
/// Identifies the VerticalGridLinesBrush dependency property.
/// </summary>
public static readonly DependencyProperty VerticalGridLinesBrushProperty =
DependencyProperty.Register(
"VerticalGridLinesBrush",
typeof(Brush),
typeof(DataGrid),
new PropertyMetadata(null, OnVerticalGridLinesBrushPropertyChanged));
/// <summary>
/// VerticalGridLinesBrushProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its VerticalGridLinesBrush.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnVerticalGridLinesBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (dataGrid._rowsPresenter != null)
{
foreach (DataGridRow row in dataGrid.GetAllRows())
{
row.EnsureGridLines();
}
}
}
/// <summary>
/// Gets or sets a value indicating how the vertical scroll bar is displayed.
/// </summary>
public ScrollBarVisibility VerticalScrollBarVisibility
{
get { return (ScrollBarVisibility)GetValue(VerticalScrollBarVisibilityProperty); }
set { SetValue(VerticalScrollBarVisibilityProperty, value); }
}
/// <summary>
/// Identifies the VerticalScrollBarVisibility dependency property.
/// </summary>
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty =
DependencyProperty.Register(
"VerticalScrollBarVisibility",
typeof(ScrollBarVisibility),
typeof(DataGrid),
new PropertyMetadata(DATAGRID_defaultScrollBarVisibility, OnVerticalScrollBarVisibilityPropertyChanged));
/// <summary>
/// VerticalScrollBarVisibilityProperty property changed handler.
/// </summary>
/// <param name="d">DataGrid that changed its VerticalScrollBarVisibility.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnVerticalScrollBarVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataGrid dataGrid = d as DataGrid;
if (!dataGrid.IsHandlerSuspended(e.Property) && (ScrollBarVisibility)e.NewValue != (ScrollBarVisibility)e.OldValue)
{
dataGrid.UpdateRowsPresenterManipulationMode(false /*horizontalMode*/, true /*verticalMode*/);
if (dataGrid._vScrollBar != null)
{
if (dataGrid.IsVerticalScrollBarOverCells)
{
dataGrid.ComputeScrollBarsLayout();
}
else
{
dataGrid.InvalidateMeasure();
}
}
}
}
/// <summary>
/// Gets a collection that contains all the columns in the control.
/// </summary>
public ObservableCollection<DataGridColumn> Columns
{
get
{
// we use a backing field here because the field's type
// is a subclass of the property's
return this.ColumnsInternal;
}
}
/// <summary>
/// Gets or sets the column that contains the current cell.
/// </summary>
public DataGridColumn CurrentColumn
{
get
{
if (this.CurrentColumnIndex == -1)
{
return null;
}
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
return this.ColumnsItemsInternal[this.CurrentColumnIndex];
}
set
{
DataGridColumn dataGridColumn = value;
if (dataGridColumn == null)
{
throw DataGridError.DataGrid.ValueCannotBeSetToNull("value", "CurrentColumn");
}
if (this.CurrentColumn != dataGridColumn)
{
if (dataGridColumn.OwningGrid != this)
{
// Provided column does not belong to this DataGrid
throw DataGridError.DataGrid.ColumnNotInThisDataGrid();
}
if (dataGridColumn.Visibility == Visibility.Collapsed)
{
// CurrentColumn cannot be set to an invisible column
throw DataGridError.DataGrid.ColumnCannotBeCollapsed();
}
if (this.CurrentSlot == -1)
{
// There is no current row so the current column cannot be set
throw DataGridError.DataGrid.NoCurrentRow();
}
bool beginEdit = _editingColumnIndex != -1;
if (!EndCellEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, this.ContainsFocus /*keepFocus*/, true /*raiseEvents*/))
{
// Edited value couldn't be committed or aborted
return;
}
if (_noFocusedColumnChangeCount == 0)
{
this.ColumnHeaderHasFocus = false;
}
this.UpdateSelectionAndCurrency(dataGridColumn.Index, this.CurrentSlot, DataGridSelectionAction.None, false /*scrollIntoView*/);
DiagnosticsDebug.Assert(_successfullyUpdatedSelection, "Expected _successfullyUpdatedSelection is true.");
if (beginEdit &&
_editingColumnIndex == -1 &&
this.CurrentSlot != -1 &&
this.CurrentColumnIndex != -1 &&
this.CurrentColumnIndex == dataGridColumn.Index &&
dataGridColumn.OwningGrid == this &&
!GetColumnEffectiveReadOnlyState(dataGridColumn))
{
// Returning to editing mode since the grid was in that mode prior to the EndCellEdit call above.
BeginCellEdit(new RoutedEventArgs());
}
}
}
}
/// <summary>
/// Gets or sets the label to display in a DataGridRowGroupHeader when its PropertyName is not set.
/// </summary>
public string RowGroupHeaderPropertyNameAlternative
{
get
{
return _rowGroupHeaderPropertyNameAlternative;
}
set
{
_rowGroupHeaderPropertyNameAlternative = value;
}
}
/// <summary>
/// Gets the style that is used when rendering the row group header.
/// </summary>
public ObservableCollection<Style> RowGroupHeaderStyles
{
get
{
return _rowGroupHeaderStyles;
}
}
/// <summary>
/// Gets a list that contains the data items corresponding to the selected rows.
/// </summary>
public IList SelectedItems
{
get { return _selectedItems as IList; }
}
/// <summary>
/// Gets the data item bound to the row that contains the current cell.
/// </summary>
protected object CurrentItem
{
get
{
if (this.CurrentSlot == -1 ||
this.RowGroupHeadersTable.Contains(this.CurrentSlot) ||
this.ItemsSource /*this.DataConnection.DataSource*/ == null)
{
return null;
}
return this.DataConnection.GetDataItem(RowIndexFromSlot(this.CurrentSlot));
}
}
internal static double HorizontalGridLinesThickness
{
get
{
return DATAGRID_horizontalGridLinesThickness;
}
}
internal int AnchorSlot
{
get;
private set;
}
internal double ActualRowHeaderWidth
{
get
{
if (!this.AreRowHeadersVisible)
{
return 0;
}
else
{
return !double.IsNaN(this.RowHeaderWidth) ? this.RowHeaderWidth : this.RowHeadersDesiredWidth;
}
}
}
internal double ActualRowsPresenterHeight
{
get
{
if (_rowsPresenter != null)
{
return _rowsPresenter.ActualHeight;
}
return 0;
}
}
internal bool AllowsManipulation
{
get
{
return _rowsPresenter != null &&
(_rowsPresenter.ManipulationMode & (ManipulationModes.TranslateX | ManipulationModes.TranslateY)) != ManipulationModes.None;
}
}
internal bool AreColumnHeadersVisible
{
get
{
return (this.HeadersVisibility & DataGridHeadersVisibility.Column) == DataGridHeadersVisibility.Column;
}
}
internal bool AreRowHeadersVisible
{
get
{
return (this.HeadersVisibility & DataGridHeadersVisibility.Row) == DataGridHeadersVisibility.Row;
}
}
/// <summary>
/// Gets or sets a value indicating whether or not at least one auto-sizing column is waiting for all the rows
/// to be measured before its final width is determined.
/// </summary>
internal bool AutoSizingColumns
{
get
{
return _autoSizingColumns;
}
set
{
if (_autoSizingColumns && value == false && this.ColumnsInternal != null)
{
double adjustment = this.CellsWidth - this.ColumnsInternal.VisibleEdgedColumnsWidth;
this.AdjustColumnWidths(0, adjustment, false);
foreach (DataGridColumn column in this.ColumnsInternal.GetVisibleColumns())
{
column.IsInitialDesiredWidthDetermined = true;
}
this.ColumnsInternal.EnsureVisibleEdgedColumnsWidth();
this.ComputeScrollBarsLayout();
InvalidateColumnHeadersMeasure();
InvalidateRowsMeasure(true);
}
_autoSizingColumns = value;
}
}
internal double AvailableSlotElementRoom
{
get;
set;
}
// Height currently available for cells this value is smaller. This height is reduced by the existence of ColumnHeaders
// or a horizontal scrollbar. Layout is asynchronous so changes to the ColumnHeaders or the horizontal scrollbar are
// not reflected immediately.
internal double CellsHeight
{
get
{
return this.RowsPresenterAvailableSize.HasValue ? this.RowsPresenterAvailableSize.Value.Height : 0;
}
}
// Width currently available for cells this value is smaller. This width is reduced by the existence of RowHeaders
// or a vertical scrollbar. Layout is asynchronous so changes to the RowHeaders or the vertical scrollbar are
// not reflected immediately
internal double CellsWidth
{
get
{
double rowsWidth = double.PositiveInfinity;
if (this.RowsPresenterAvailableSize.HasValue)
{
rowsWidth = Math.Max(0, this.RowsPresenterAvailableSize.Value.Width - this.ActualRowHeaderWidth);
}
return double.IsPositiveInfinity(rowsWidth) ? this.ColumnsInternal.VisibleEdgedColumnsWidth : rowsWidth;
}
}
/// <summary>
/// Gets an empty content control that's used during the DataGrid's copy procedure
/// to determine the value of a ClipboardContentBinding for a particular column and item.
/// </summary>
internal ContentControl ClipboardContentControl
{
get
{
if (_clipboardContentControl == null)
{
_clipboardContentControl = new ContentControl();
}
return _clipboardContentControl;
}
}
internal bool ColumnHeaderHasFocus
{
get
{
return _columnHeaderHasFocus;
}
set
{
DiagnosticsDebug.Assert(!value || (this.ColumnHeaders != null && this.AreColumnHeadersVisible), "Expected value==False || (non-null ColumnHeaders and AreColumnHeadersVisible==True)");
if (_columnHeaderHasFocus != value)
{
_columnHeaderHasFocus = value;
if (this.CurrentColumn != null && this.IsSlotVisible(this.CurrentSlot))
{
UpdateCurrentState(this.DisplayData.GetDisplayedElement(this.CurrentSlot), this.CurrentColumnIndex, true /*applyCellState*/);
}
DataGridColumn oldFocusedColumn = this.FocusedColumn;
this.FocusedColumn = null;
if (_columnHeaderHasFocus)
{
this.FocusedColumn = this.CurrentColumn == null ? this.ColumnsInternal.FirstVisibleNonFillerColumn : this.CurrentColumn;
}
if (oldFocusedColumn != null && oldFocusedColumn.HasHeaderCell)
{
oldFocusedColumn.HeaderCell.ApplyState(true);
}
if (this.FocusedColumn != null && this.FocusedColumn.HasHeaderCell)
{
this.FocusedColumn.HeaderCell.ApplyState(true);
ScrollColumnIntoView(this.FocusedColumn.Index);
}
}
}
}
internal DataGridColumnHeaderInteractionInfo ColumnHeaderInteractionInfo
{
get;
set;
}
internal DataGridColumnHeadersPresenter ColumnHeaders
{
get
{
return _columnHeadersPresenter;
}
}
internal DataGridColumnCollection ColumnsInternal
{
get;
private set;
}
internal List<DataGridColumn> ColumnsItemsInternal
{
get
{
return this.ColumnsInternal.ItemsInternal;
}
}
internal bool ContainsFocus
{
get;
private set;
}
internal int CurrentColumnIndex
{
get
{
return this.CurrentCellCoordinates.ColumnIndex;
}
private set
{
this.CurrentCellCoordinates.ColumnIndex = value;
}
}
internal int CurrentSlot
{
get
{
return this.CurrentCellCoordinates.Slot;
}
private set
{
this.CurrentCellCoordinates.Slot = value;
}
}
internal DataGridDataConnection DataConnection
{
get;
private set;
}
internal DataGridDisplayData DisplayData
{
get;
private set;
}
internal int EditingColumnIndex
{
get
{
return _editingColumnIndex;
}
}
internal DataGridRow EditingRow
{
get;
private set;
}
internal double FirstDisplayedScrollingColumnHiddenWidth
{
get
{
return _negHorizontalOffset;
}
}
internal DataGridColumn FocusedColumn
{
get;
set;
}
internal bool HasColumnUserInteraction
{
get
{
return this.ColumnHeaderInteractionInfo.HasUserInteraction;
}
}
// When the RowsPresenter's width increases, the HorizontalOffset will be incorrect until
// the scrollbar's layout is recalculated, which doesn't occur until after the cells are measured.
// This property exists to account for this scenario, and avoid collapsing the incorrect cells.
internal double HorizontalAdjustment
{
get;
private set;
}
// the sum of the widths in pixels of the scrolling columns preceding
// the first displayed scrolling column
internal double HorizontalOffset
{
get
{
return _horizontalOffset;
}
set
{
if (value < 0)
{
value = 0;
}
double widthNotVisible = Math.Max(0, this.ColumnsInternal.VisibleEdgedColumnsWidth - this.CellsWidth);
if (value > widthNotVisible)
{
value = widthNotVisible;
}
if (value == _horizontalOffset)
{
return;
}
SetHorizontalOffset(value);
_horizontalOffset = value;
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
// update the lastTotallyDisplayedScrollingCol
ComputeDisplayedColumns();
}
}
internal ScrollBar HorizontalScrollBar
{
get
{
return _hScrollBar;
}
}
internal bool LoadingOrUnloadingRow
{
get;
private set;
}
internal bool InDisplayIndexAdjustments
{
get;
set;
}
internal double NegVerticalOffset
{
get;
private set;
}
internal int NoCurrentCellChangeCount
{
get
{
return _noCurrentCellChangeCount;
}
set
{
DiagnosticsDebug.Assert(value >= 0, "Expected positive NoCurrentCellChangeCount.");
_noCurrentCellChangeCount = value;
if (value == 0)
{
FlushCurrentCellChanged();
}
}
}
internal double RowDetailsHeightEstimate
{
get;
private set;
}
internal double RowHeadersDesiredWidth
{
get
{
return _rowHeaderDesiredWidth;
}
set
{
// We only auto grow
if (_rowHeaderDesiredWidth < value)
{
double oldActualRowHeaderWidth = this.ActualRowHeaderWidth;
_rowHeaderDesiredWidth = value;
if (oldActualRowHeaderWidth != this.ActualRowHeaderWidth)
{
bool invalidated = EnsureRowHeaderWidth();
// If we didn't invalidate in Ensure and we have star columns, force the column widths to be recomputed here.
if (!invalidated && this.ColumnsInternal.VisibleStarColumnCount > 0)
{
this.ColumnsInternal.EnsureVisibleEdgedColumnsWidth();
InvalidateMeasure();
}
}
}
}
}
internal double RowGroupHeaderHeightEstimate
{
get;
private set;
}
internal IndexToValueTable<DataGridRowGroupInfo> RowGroupHeadersTable
{
get;
private set;
}
internal double[] RowGroupSublevelIndents
{
get;
private set;
}
internal double RowHeightEstimate
{
get;
private set;
}
internal Size? RowsPresenterAvailableSize
{
get
{
return _rowsPresenterAvailableSize;
}
set
{
if (_rowsPresenterAvailableSize.HasValue && value.HasValue && value.Value.Width > this.RowsPresenterAvailableSize.Value.Width)
{
// When the available cells width increases, the horizontal offset can be incorrect.
// Store away an adjustment to use during the CellsPresenter's measure, so that the
// ShouldDisplayCell method correctly determines if a cell will be in view.
//
// | h. offset | new available cells width |
// |-------------->|----------------------------------------->|
// __________________________________________________ |
// | | | | | |
// | column0 | column1 | column2 | column3 |<----->|
// | | | | | adj. |
double adjustment = (_horizontalOffset + value.Value.Width) - this.ColumnsInternal.VisibleEdgedColumnsWidth;
this.HorizontalAdjustment = Math.Min(this.HorizontalOffset, Math.Max(0, adjustment));
}
else
{
this.HorizontalAdjustment = 0;
}
bool loadMoreDataFromIncrementalItemsSource = _rowsPresenterAvailableSize.HasValue && value.HasValue && value.Value.Height > _rowsPresenterAvailableSize.Value.Height;
_rowsPresenterAvailableSize = value;
if (loadMoreDataFromIncrementalItemsSource)
{
LoadMoreDataFromIncrementalItemsSource();
}
}
}
// This flag indicates whether selection has actually changed during a selection operation,
// and exists to ensure that FlushSelectionChanged doesn't unnecessarily raise SelectionChanged.
internal bool SelectionHasChanged
{
get;
set;
}
internal int SlotCount
{
get;
private set;
}
internal bool UpdatedStateOnTapped
{
get;
set;
}
/// <summary>
/// Gets a value indicating whether or not to use star-sizing logic. If the DataGrid has infinite available space,
/// then star sizing doesn't make sense. In this case, all star columns grow to a predefined size of
/// 10,000 pixels in order to show the developer that star columns shouldn't be used.
/// </summary>
internal bool UsesStarSizing
{
get
{
if (this.ColumnsInternal != null)
{
return this.ColumnsInternal.VisibleStarColumnCount > 0 &&
(!this.RowsPresenterAvailableSize.HasValue || !double.IsPositiveInfinity(this.RowsPresenterAvailableSize.Value.Width));
}
return false;
}
}
internal double VerticalOffset
{
get
{
return _verticalOffset;
}
set
{
bool loadMoreDataFromIncrementalItemsSource = _verticalOffset < value;
_verticalOffset = value;
if (loadMoreDataFromIncrementalItemsSource)
{
LoadMoreDataFromIncrementalItemsSource();
}
}
}
internal ScrollBar VerticalScrollBar
{
get
{
return _vScrollBar;
}
}
internal int VisibleSlotCount
{
get;
set;
}
private bool AreAllScrollBarsCollapsed
{
get
{
return (_hScrollBar == null || _hScrollBar.Visibility == Visibility.Collapsed) &&
(_vScrollBar == null || _vScrollBar.Visibility == Visibility.Collapsed);
}
}
private bool AreBothScrollBarsVisible
{
get
{
return _hScrollBar != null && _hScrollBar.Visibility == Visibility.Visible &&
_vScrollBar != null && _vScrollBar.Visibility == Visibility.Visible;
}
}
private DataGridCellCoordinates CurrentCellCoordinates
{
get
{
return _currentCellCoordinates;
}
set
{
_currentCellCoordinates = value;
}
}
private int FirstDisplayedNonFillerColumnIndex
{
get
{
DataGridColumn column = this.ColumnsInternal.FirstVisibleNonFillerColumn;
if (column != null)
{
if (column.IsFrozen)
{
return column.Index;
}
else
{
if (this.DisplayData.FirstDisplayedScrollingCol >= column.Index)
{
return this.DisplayData.FirstDisplayedScrollingCol;
}
else
{
return column.Index;
}
}
}
return -1;
}
}
private bool IsHorizontalScrollBarInteracting
{
get
{
return _isHorizontalScrollBarInteracting;
}
set
{
if (_isHorizontalScrollBarInteracting != value)
{
_isHorizontalScrollBarInteracting = value;
if (_hScrollBar != null)
{
if (_isHorizontalScrollBarInteracting)
{
// Prevent the vertical scroll bar from fading out while the user is interacting with the horizontal one.
_keepScrollBarsShowing = true;
ShowScrollBars();
}
else
{
// Make the scroll bars fade out, after the normal delay.
_keepScrollBarsShowing = false;
HideScrollBars(true /*useTransitions*/);
}
}
}
}
}
private bool IsHorizontalScrollBarOverCells
{
get
{
return _columnHeadersPresenter != null && Grid.GetColumnSpan(_columnHeadersPresenter) == 2;
}
}
private bool IsVerticalScrollBarInteracting
{
get
{
return _isVerticalScrollBarInteracting;
}
set
{
if (_isVerticalScrollBarInteracting != value)
{
_isVerticalScrollBarInteracting = value;
if (_vScrollBar != null)
{
if (_isVerticalScrollBarInteracting)
{
// Prevent the horizontal scroll bar from fading out while the user is interacting with the vertical one.
_keepScrollBarsShowing = true;
ShowScrollBars();
}
else
{
// Make the scroll bars fade out, after the normal delay.
_keepScrollBarsShowing = false;
HideScrollBars(true /*useTransitions*/);
}
}
}
}
}
private bool IsVerticalScrollBarOverCells
{
get
{
return _rowsPresenter != null && Grid.GetRowSpan(_rowsPresenter) == 2;
}
}
private VirtualKey LastHandledKeyDown
{
get;
set;
}
private int NoSelectionChangeCount
{
get
{
return _noSelectionChangeCount;
}
set
{
DiagnosticsDebug.Assert(value >= 0, "Expected positive NoSelectionChangeCount.");
_noSelectionChangeCount = value;
if (value == 0)
{
FlushSelectionChanged();
}
}
}
/// <summary>
/// Enters editing mode for the current cell and current row (if they're not already in editing mode).
/// </summary>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool BeginEdit()
{
return BeginEdit(null);
}
/// <summary>
/// Enters editing mode for the current cell and current row (if they're not already in editing mode).
/// </summary>
/// <param name="editingEventArgs">Provides information about the user gesture that caused the call to BeginEdit. Can be null.</param>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool BeginEdit(RoutedEventArgs editingEventArgs)
{
if (this.CurrentColumnIndex == -1 || !GetRowSelection(this.CurrentSlot))
{
return false;
}
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
if (GetColumnEffectiveReadOnlyState(this.CurrentColumn))
{
// Current column is read-only
return false;
}
return BeginCellEdit(editingEventArgs);
}
/// <summary>
/// Cancels editing mode and restores the original value.
/// </summary>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool CancelEdit()
{
return CancelEdit(DataGridEditingUnit.Row);
}
/// <summary>
/// Cancels editing mode for the specified DataGridEditingUnit and restores its original value.
/// </summary>
/// <param name="editingUnit">Specifies whether to cancel edit for a Cell or Row.</param>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool CancelEdit(DataGridEditingUnit editingUnit)
{
return this.CancelEdit(editingUnit, true /*raiseEvents*/);
}
/// <summary>
/// Commits editing mode and pushes changes to the backend.
/// </summary>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool CommitEdit()
{
return CommitEdit(DataGridEditingUnit.Row, true);
}
/// <summary>
/// Commits editing mode for the specified DataGridEditingUnit and pushes changes to the backend.
/// </summary>
/// <param name="editingUnit">Specifies whether to commit edit for a Cell or Row.</param>
/// <param name="exitEditingMode">Editing mode is left if True.</param>
/// <returns>True if operation was successful. False otherwise.</returns>
public bool CommitEdit(DataGridEditingUnit editingUnit, bool exitEditingMode)
{
if (!EndCellEdit(DataGridEditAction.Commit, editingUnit == DataGridEditingUnit.Cell ? exitEditingMode : true, this.ContainsFocus /*keepFocus*/, true /*raiseEvents*/))
{
return false;
}
if (editingUnit == DataGridEditingUnit.Row)
{
return EndRowEdit(DataGridEditAction.Commit, exitEditingMode, true /*raiseEvents*/);
}
return true;
}
/// <summary>
/// Returns the Group at the indicated level or null if the item is not in the ItemsSource
/// </summary>
/// <param name="item">item</param>
/// <param name="groupLevel">groupLevel</param>
/// <returns>The group the given item falls under or null if the item is not in the ItemsSource</returns>
public ICollectionViewGroup GetGroupFromItem(object item, int groupLevel)
{
int itemIndex = this.DataConnection.IndexOf(item);
if (itemIndex == -1)
{
return null;
}
int groupHeaderSlot = this.RowGroupHeadersTable.GetPreviousIndex(SlotFromRowIndex(itemIndex));
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(groupHeaderSlot);
while (rowGroupInfo != null && rowGroupInfo.Level != groupLevel)
{
groupHeaderSlot = this.RowGroupHeadersTable.GetPreviousIndex(rowGroupInfo.Slot);
rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(groupHeaderSlot);
}
return rowGroupInfo == null ? null : rowGroupInfo.CollectionViewGroup;
}
/// <summary>
/// Scrolls the specified item or RowGroupHeader and/or column into view.
/// If item is not null: scrolls the row representing the item into view;
/// If column is not null: scrolls the column into view;
/// If both item and column are null, the method returns without scrolling.
/// </summary>
/// <param name="item">an item from the DataGrid's items source or a CollectionViewGroup from the collection view</param>
/// <param name="column">a column from the DataGrid's columns collection</param>
public void ScrollIntoView(object item, DataGridColumn column)
{
if ((column == null && (item == null || this.FirstDisplayedNonFillerColumnIndex == -1)) ||
(column != null && column.OwningGrid != this))
{
// no-op
return;
}
if (item == null)
{
// scroll column into view
this.ScrollSlotIntoView(column.Index, this.DisplayData.FirstScrollingSlot, false /*forCurrentCellChange*/, true /*forceHorizontalScroll*/);
}
else
{
int slot;
DataGridRowGroupInfo rowGroupInfo = null;
ICollectionViewGroup collectionViewGroup = item as ICollectionViewGroup;
if (collectionViewGroup != null)
{
rowGroupInfo = RowGroupInfoFromCollectionViewGroup(collectionViewGroup);
if (rowGroupInfo == null)
{
Debug.Fail("Expected non-null rowGroupInfo.");
return;
}
slot = rowGroupInfo.Slot;
}
else
{
// the row index will be set to -1 if the item is null or not in the list
int rowIndex = this.DataConnection.IndexOf(item);
if (rowIndex == -1 || (this.IsReadOnly && rowIndex == this.DataConnection.NewItemPlaceholderIndex))
{
return;
}
slot = SlotFromRowIndex(rowIndex);
}
int columnIndex = (column == null) ? this.FirstDisplayedNonFillerColumnIndex : column.Index;
if (_collapsedSlotsTable.Contains(slot))
{
// We need to expand all parent RowGroups so that the slot is visible
if (rowGroupInfo != null)
{
ExpandRowGroupParentChain(rowGroupInfo.Level - 1, rowGroupInfo.Slot);
}
else
{
rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(this.RowGroupHeadersTable.GetPreviousIndex(slot));
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
if (rowGroupInfo != null)
{
ExpandRowGroupParentChain(rowGroupInfo.Level, rowGroupInfo.Slot);
}
}
// Update ScrollBar and display information
this.NegVerticalOffset = 0;
SetVerticalOffset(0);
ResetDisplayedRows();
this.DisplayData.FirstScrollingSlot = 0;
ComputeScrollBarsLayout();
}
ScrollSlotIntoView(columnIndex, slot, true /*forCurrentCellChange*/, true /*forceHorizontalScroll*/);
}
}
/// <summary>
/// Arranges the content of the <see cref="DataGridRow"/>.
/// </summary>
/// <param name="finalSize">
/// The final area within the parent that this element should use to arrange itself and its children.
/// </param>
/// <returns>
/// The actual size used by the <see cref="DataGridRow"/>.
/// </returns>
protected override Size ArrangeOverride(Size finalSize)
{
if (_makeFirstDisplayedCellCurrentCellPending)
{
MakeFirstDisplayedCellCurrentCell();
}
if (this.ActualWidth != finalSize.Width)
{
// If our final width has changed, we might need to update the filler
InvalidateColumnHeadersArrange();
InvalidateCellsArrange();
}
return base.ArrangeOverride(finalSize);
}
/// <summary>
/// Measures the children of a <see cref="DataGridRow"/> to prepare for
/// arranging them during the
/// <see cref="M:System.Windows.Controls.DataGridRow.ArrangeOverride(System.Windows.Size)"/> pass.
/// </summary>
/// <returns>
/// The size that the <see cref="DataGridRow"/> determines it needs during layout, based on its calculations of child object allocated sizes.
/// </returns>
/// <param name="availableSize">
/// The available size that this element can give to child elements. Indicates an upper limit that
/// child elements should not exceed.
/// </param>
protected override Size MeasureOverride(Size availableSize)
{
// Delay layout until after the initial measure to avoid invalid calculations when the
// DataGrid is not part of the visual tree
if (!_measured)
{
_measured = true;
// We don't need to clear the rows because it was already done when the ItemsSource changed
RefreshRowsAndColumns(false /*clearRows*/);
// Update our estimates now that the DataGrid has all of the information necessary
UpdateRowDetailsHeightEstimate();
// Update frozen columns to account for columns added prior to loading or auto-generated columns
if (this.FrozenColumnCountWithFiller > 0)
{
ProcessFrozenColumnCount(this);
}
}
Size desiredSize;
// This is a shortcut to skip layout if we don't have any columns
if (this.ColumnsInternal.Count == 0)
{
if (_hScrollBar != null && _hScrollBar.Visibility != Visibility.Collapsed)
{
_hScrollBar.Visibility = Visibility.Collapsed;
}
if (_vScrollBar != null && _vScrollBar.Visibility != Visibility.Collapsed)
{
_vScrollBar.Visibility = Visibility.Collapsed;
}
desiredSize = base.MeasureOverride(availableSize);
}
else
{
if (_rowsPresenter != null)
{
_rowsPresenter.InvalidateMeasure();
}
InvalidateColumnHeadersMeasure();
desiredSize = base.MeasureOverride(availableSize);
ComputeScrollBarsLayout();
}
return desiredSize;
}
/// <summary>
/// Comparator class so we can sort list by the display index
/// </summary>
public class DisplayIndexComparer : IComparer<DataGridColumn>
{
// Calls CaseInsensitiveComparer.Compare with the parameters reversed.
int IComparer<DataGridColumn>.Compare(DataGridColumn x, DataGridColumn y)
{
return (x.DisplayIndexWithFiller < y.DisplayIndexWithFiller) ? -1 : 1;
}
}
/// <summary>
/// Builds the visual tree for the column header when a new template is applied.
/// </summary>
protected override void OnApplyTemplate()
{
// The template has changed, so we need to refresh the visuals
_measured = false;
_hasNoIndicatorStateStoryboardCompletedHandler = false;
_keepScrollBarsShowing = false;
if (_columnHeadersPresenter != null)
{
// If we're applying a new template, we want to remove the old column headers first
_columnHeadersPresenter.Children.Clear();
}
_columnHeadersPresenter = GetTemplateChild(DATAGRID_elementColumnHeadersPresenterName) as DataGridColumnHeadersPresenter;
if (_columnHeadersPresenter != null)
{
if (this.ColumnsInternal.FillerColumn != null)
{
this.ColumnsInternal.FillerColumn.IsRepresented = false;
}
_columnHeadersPresenter.OwningGrid = this;
// Columns were added before our Template was applied, add the ColumnHeaders now
List<DataGridColumn> sortedInternal = new List<DataGridColumn>(this.ColumnsItemsInternal);
sortedInternal.Sort(new DisplayIndexComparer());
foreach (DataGridColumn column in sortedInternal)
{
InsertDisplayedColumnHeader(column);
}
}
if (_rowsPresenter != null)
{
// If we're applying a new template, we want to remove the old rows first
this.UnloadElements(false /*recycle*/);
}
_rowsPresenter = GetTemplateChild(DATAGRID_elementRowsPresenterName) as DataGridRowsPresenter;
if (_rowsPresenter != null)
{
_rowsPresenter.OwningGrid = this;
InvalidateRowHeightEstimate();
UpdateRowDetailsHeightEstimate();
UpdateRowsPresenterManipulationMode(true /*horizontalMode*/, true /*verticalMode*/);
}
_frozenColumnScrollBarSpacer = GetTemplateChild(DATAGRID_elementFrozenColumnScrollBarSpacerName) as FrameworkElement;
if (_hScrollBar != null)
{
_isHorizontalScrollBarInteracting = false;
_isPointerOverHorizontalScrollBar = false;
UnhookHorizontalScrollBarEvents();
}
_hScrollBar = GetTemplateChild(DATAGRID_elementHorizontalScrollBarName) as ScrollBar;
if (_hScrollBar != null)
{
_hScrollBar.IsTabStop = false;
_hScrollBar.Maximum = 0.0;
_hScrollBar.Orientation = Orientation.Horizontal;
_hScrollBar.Visibility = Visibility.Collapsed;
HookHorizontalScrollBarEvents();
}
if (_vScrollBar != null)
{
_isVerticalScrollBarInteracting = false;
_isPointerOverVerticalScrollBar = false;
UnhookVerticalScrollBarEvents();
}
_vScrollBar = GetTemplateChild(DATAGRID_elementVerticalScrollBarName) as ScrollBar;
if (_vScrollBar != null)
{
_vScrollBar.IsTabStop = false;
_vScrollBar.Maximum = 0.0;
_vScrollBar.Orientation = Orientation.Vertical;
_vScrollBar.Visibility = Visibility.Collapsed;
HookVerticalScrollBarEvents();
}
_topLeftCornerHeader = GetTemplateChild(DATAGRID_elementTopLeftCornerHeaderName) as ContentControl;
EnsureTopLeftCornerHeader(); // EnsureTopLeftCornerHeader checks for a null _topLeftCornerHeader;
_topRightCornerHeader = GetTemplateChild(DATAGRID_elementTopRightCornerHeaderName) as ContentControl;
_bottomRightCorner = GetTemplateChild(DATAGRID_elementBottomRightCornerHeaderName) as UIElement;
#if FEATURE_VALIDATION_SUMMARY
if (_validationSummary != null)
{
_validationSummary.FocusingInvalidControl -= new EventHandler<FocusingInvalidControlEventArgs>(ValidationSummary_FocusingInvalidControl);
_validationSummary.SelectionChanged -= new EventHandler<SelectionChangedEventArgs>(ValidationSummary_SelectionChanged);
}
_validationSummary = GetTemplateChild(DATAGRID_elementValidationSummary) as ValidationSummary;
if (_validationSummary != null)
{
// The ValidationSummary defaults to using its parent if Target is null, so the only
// way to prevent it from automatically picking up errors is to set it to some useless element.
if (_validationSummary.Target == null)
{
_validationSummary.Target = new Rectangle();
}
_validationSummary.FocusingInvalidControl += new EventHandler<FocusingInvalidControlEventArgs>(ValidationSummary_FocusingInvalidControl);
_validationSummary.SelectionChanged += new EventHandler<SelectionChangedEventArgs>(ValidationSummary_SelectionChanged);
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
DiagnosticsDebug.Assert(_validationSummary.Errors != null);
// Do not add the default design time errors when in design mode.
_validationSummary.Errors.Clear();
}
}
#endif
FrameworkElement root = GetTemplateChild(DATAGRID_elementRootName) as FrameworkElement;
if (root != null)
{
IList<VisualStateGroup> rootVisualStateGroups = VisualStateManager.GetVisualStateGroups(root);
if (rootVisualStateGroups != null)
{
int groupCount = rootVisualStateGroups.Count;
for (int groupIndex = 0; groupIndex < groupCount; groupIndex++)
{
VisualStateGroup group = rootVisualStateGroups[groupIndex];
if (group != null)
{
IList<VisualState> visualStates = group.States;
if (visualStates != null)
{
int stateCount = visualStates.Count;
for (int stateIndex = 0; stateIndex < stateCount; stateIndex++)
{
VisualState state = visualStates[stateIndex];
if (state != null)
{
string stateName = state.Name;
Storyboard stateStoryboard = state.Storyboard;
if (stateStoryboard != null)
{
if (stateName == VisualStates.StateNoIndicator)
{
stateStoryboard.Completed += NoIndicatorStateStoryboard_Completed;
_hasNoIndicatorStateStoryboardCompletedHandler = true;
}
else if (stateName == VisualStates.StateTouchIndicator || stateName == VisualStates.StateMouseIndicator || stateName == VisualStates.StateMouseIndicatorFull)
{
stateStoryboard.Completed += IndicatorStateStoryboard_Completed;
}
}
}
}
}
}
}
}
}
HideScrollBars(false /*useTransitions*/);
UpdateDisabledVisual();
}
/// <summary>
/// Raises the AutoGeneratingColumn event.
/// </summary>
protected virtual void OnAutoGeneratingColumn(DataGridAutoGeneratingColumnEventArgs e)
{
EventHandler<DataGridAutoGeneratingColumnEventArgs> handler = this.AutoGeneratingColumn;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Raises the BeginningEdit event.
/// </summary>
protected virtual void OnBeginningEdit(DataGridBeginningEditEventArgs e)
{
EventHandler<DataGridBeginningEditEventArgs> handler = this.BeginningEdit;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Raises the CellEditEnded event.
/// </summary>
protected virtual void OnCellEditEnded(DataGridCellEditEndedEventArgs e)
{
EventHandler<DataGridCellEditEndedEventArgs> handler = this.CellEditEnded;
if (handler != null)
{
handler(this, e);
}
// Raise the automation invoke event for the cell that just ended edit
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
{
peer.RaiseAutomationInvokeEvents(DataGridEditingUnit.Cell, e.Column, e.Row);
}
}
/// <summary>
/// Raises the CellEditEnding event.
/// </summary>
protected virtual void OnCellEditEnding(DataGridCellEditEndingEventArgs e)
{
EventHandler<DataGridCellEditEndingEventArgs> handler = this.CellEditEnding;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// This method raises the CopyingRowClipboardContent event.
/// </summary>
/// <param name="e">Contains the necessary information for generating the row clipboard content.</param>
protected virtual void OnCopyingRowClipboardContent(DataGridRowClipboardEventArgs e)
{
EventHandler<DataGridRowClipboardEventArgs> handler = this.CopyingRowClipboardContent;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Creates AutomationPeer (<see cref="UIElement.OnCreateAutomationPeer"/>)
/// </summary>
/// <returns>An automation peer for this <see cref="DataGrid"/>.</returns>
protected override AutomationPeer OnCreateAutomationPeer()
{
return new DataGridAutomationPeer(this);
}
/// <summary>
/// Raises the CurrentCellChanged event.
/// </summary>
protected virtual void OnCurrentCellChanged(EventArgs e)
{
EventHandler<EventArgs> handler = this.CurrentCellChanged;
if (handler != null)
{
handler(this, e);
}
if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected))
{
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationCellSelectedEvent(this.CurrentSlot, this.CurrentColumnIndex);
}
}
}
/// <summary>
/// Raises the LoadingRow event for row preparation.
/// </summary>
protected virtual void OnLoadingRow(DataGridRowEventArgs e)
{
EventHandler<DataGridRowEventArgs> handler = this.LoadingRow;
if (handler != null)
{
DiagnosticsDebug.Assert(!_loadedRows.Contains(e.Row), "Expected e.Rows not contained in _loadedRows.");
_loadedRows.Add(e.Row);
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
DiagnosticsDebug.Assert(_loadedRows.Contains(e.Row), "Expected e.Rows contained in _loadedRows.");
_loadedRows.Remove(e.Row);
}
}
}
/// <summary>
/// Raises the LoadingRowGroup event
/// </summary>
/// <param name="e">EventArgs</param>
protected virtual void OnLoadingRowGroup(DataGridRowGroupHeaderEventArgs e)
{
EventHandler<DataGridRowGroupHeaderEventArgs> handler = this.LoadingRowGroup;
if (handler != null)
{
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
}
}
}
/// <summary>
/// Raises the LoadingRowDetails for row details preparation
/// </summary>
protected virtual void OnLoadingRowDetails(DataGridRowDetailsEventArgs e)
{
EventHandler<DataGridRowDetailsEventArgs> handler = this.LoadingRowDetails;
if (handler != null)
{
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
}
}
}
/// <summary>
/// Scrolls the DataGrid according to the direction of the delta.
/// </summary>
/// <param name="e">PointerRoutedEventArgs</param>
protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
{
base.OnPointerWheelChanged(e);
if (!e.Handled)
{
PointerPoint pointerPoint = e.GetCurrentPoint(this);
// A horizontal scroll happens if the mouse has a horizontal wheel OR if the horizontal scrollbar is not disabled AND the vertical scrollbar IS disabled
bool isForHorizontalScroll = pointerPoint.Properties.IsHorizontalMouseWheel ||
(this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled && this.VerticalScrollBarVisibility == ScrollBarVisibility.Disabled);
if ((isForHorizontalScroll && this.HorizontalScrollBarVisibility == ScrollBarVisibility.Disabled) ||
(!isForHorizontalScroll && this.VerticalScrollBarVisibility == ScrollBarVisibility.Disabled))
{
return;
}
double offsetDelta = -pointerPoint.Properties.MouseWheelDelta / DATAGRID_mouseWheelDeltaDivider;
if (isForHorizontalScroll && pointerPoint.Properties.IsHorizontalMouseWheel)
{
offsetDelta *= -1.0;
}
e.Handled = ProcessScrollOffsetDelta(offsetDelta, isForHorizontalScroll);
}
}
/// <summary>
/// Raises the PreparingCellForEdit event.
/// </summary>
protected virtual void OnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
{
EventHandler<DataGridPreparingCellForEditEventArgs> handler = this.PreparingCellForEdit;
if (handler != null)
{
handler(this, e);
}
// Raise the automation invoke event for the cell that just began edit because now
// its editable content has been loaded
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
{
peer.RaiseAutomationInvokeEvents(DataGridEditingUnit.Cell, e.Column, e.Row);
}
}
/// <summary>
/// Raises the RowEditEnded event.
/// </summary>
protected virtual void OnRowEditEnded(DataGridRowEditEndedEventArgs e)
{
EventHandler<DataGridRowEditEndedEventArgs> handler = this.RowEditEnded;
if (handler != null)
{
handler(this, e);
}
// Raise the automation invoke event for the row that just ended edit because the edits
// to its associated item have either been committed or reverted
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
{
peer.RaiseAutomationInvokeEvents(DataGridEditingUnit.Row, null, e.Row);
}
}
/// <summary>
/// Raises the RowEditEnding event.
/// </summary>
protected virtual void OnRowEditEnding(DataGridRowEditEndingEventArgs e)
{
EventHandler<DataGridRowEditEndingEventArgs> handler = this.RowEditEnding;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Raises the SelectionChanged event and clears the _selectionChanged.
/// This event won't get raised again until after _selectionChanged is set back to true.
/// </summary>
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
{
SelectionChangedEventHandler handler = this.SelectionChanged;
if (handler != null)
{
handler(this, e);
}
if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection) ||
AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
{
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationSelectionEvents(e);
}
}
}
/// <summary>
/// Raises the UnloadingRow event for row recycling.
/// </summary>
protected virtual void OnUnloadingRow(DataGridRowEventArgs e)
{
EventHandler<DataGridRowEventArgs> handler = this.UnloadingRow;
if (handler != null)
{
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
}
}
}
/// <summary>
/// Raises the UnloadingRowDetails event
/// </summary>
protected virtual void OnUnloadingRowDetails(DataGridRowDetailsEventArgs e)
{
EventHandler<DataGridRowDetailsEventArgs> handler = this.UnloadingRowDetails;
if (handler != null)
{
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
}
}
}
/// <summary>
/// Raises the UnloadingRowGroup event
/// </summary>
/// <param name="e">EventArgs</param>
protected virtual void OnUnloadingRowGroup(DataGridRowGroupHeaderEventArgs e)
{
EventHandler<DataGridRowGroupHeaderEventArgs> handler = this.UnloadingRowGroup;
if (handler != null)
{
this.LoadingOrUnloadingRow = true;
try
{
handler(this, e);
}
finally
{
this.LoadingOrUnloadingRow = false;
}
}
}
internal static DataGridCell GetOwningCell(FrameworkElement element)
{
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
DataGridCell cell = element as DataGridCell;
while (element != null && cell == null)
{
element = element.Parent as FrameworkElement;
cell = element as DataGridCell;
}
return cell;
}
/// <summary>
/// Cancels editing mode for the specified DataGridEditingUnit and restores its original value.
/// </summary>
/// <param name="editingUnit">Specifies whether to cancel edit for a Cell or Row.</param>
/// <param name="raiseEvents">Specifies whether or not to raise editing events</param>
/// <returns>True if operation was successful. False otherwise.</returns>
internal bool CancelEdit(DataGridEditingUnit editingUnit, bool raiseEvents)
{
if (!EndCellEdit(DataGridEditAction.Cancel, true, this.ContainsFocus /*keepFocus*/, raiseEvents))
{
return false;
}
if (editingUnit == DataGridEditingUnit.Row)
{
return EndRowEdit(DataGridEditAction.Cancel, true, raiseEvents);
}
return true;
}
/// <summary>
/// call when: selection changes or SelectedItems object changes
/// </summary>
internal void CoerceSelectedItem()
{
object selectedItem = null;
if (this.SelectionMode == DataGridSelectionMode.Extended &&
this.CurrentSlot != -1 &&
_selectedItems.ContainsSlot(this.CurrentSlot))
{
selectedItem = this.CurrentItem;
}
else if (_selectedItems.Count > 0)
{
selectedItem = _selectedItems[0];
}
if (this.SelectedItem != selectedItem)
{
this.SetValueNoCallback(DataGrid.SelectedItemProperty, selectedItem);
}
// Update the SelectedIndex
int newIndex = -1;
if (selectedItem != null)
{
newIndex = this.DataConnection.IndexOf(selectedItem);
}
if (this.SelectedIndex != newIndex)
{
this.SetValueNoCallback(DataGrid.SelectedIndexProperty, newIndex);
}
}
internal IEnumerable<object> GetSelectionInclusive(int startRowIndex, int endRowIndex)
{
int endSlot = SlotFromRowIndex(endRowIndex);
foreach (int slot in _selectedItems.GetSlots(SlotFromRowIndex(startRowIndex)))
{
if (slot > endSlot)
{
break;
}
yield return this.DataConnection.GetDataItem(RowIndexFromSlot(slot));
}
}
internal void InitializeElements(bool recycleRows)
{
try
{
_noCurrentCellChangeCount++;
// The underlying collection has changed and our editing row (if there is one)
// is no longer relevant, so we should force a cancel edit.
CancelEdit(DataGridEditingUnit.Row, false /*raiseEvents*/);
// We want to persist selection throughout a reset, so store away the selected items
List<object> selectedItemsCache = new List<object>(_selectedItems.SelectedItemsCache);
if (recycleRows)
{
RefreshRows(recycleRows /*recycleRows*/, true /*clearRows*/);
}
else
{
RefreshRowsAndColumns(true /*clearRows*/);
}
// Re-select the old items
_selectedItems.SelectedItemsCache = selectedItemsCache;
CoerceSelectedItem();
if (this.RowDetailsVisibilityMode != DataGridRowDetailsVisibilityMode.Collapsed)
{
UpdateRowDetailsVisibilityMode(this.RowDetailsVisibilityMode);
}
// The currently displayed rows may have incorrect visual states because of the selection change
ApplyDisplayedRowsState(this.DisplayData.FirstScrollingSlot, this.DisplayData.LastScrollingSlot);
}
finally
{
this.NoCurrentCellChangeCount--;
}
}
// Returns the item or the CollectionViewGroup that is used as the DataContext for a given slot.
// If the DataContext is an item, rowIndex is set to the index of the item within the collection.
internal object ItemFromSlot(int slot, ref int rowIndex)
{
if (this.RowGroupHeadersTable.Contains(slot))
{
DataGridRowGroupInfo groupInfo = this.RowGroupHeadersTable.GetValueAt(slot);
if (groupInfo != null)
{
return groupInfo.CollectionViewGroup;
}
}
else
{
rowIndex = RowIndexFromSlot(slot);
return this.DataConnection.GetDataItem(rowIndex);
}
return null;
}
internal void LoadMoreDataFromIncrementalItemsSource()
{
LoadMoreDataFromIncrementalItemsSource(totalVisibleHeight: EdgedRowsHeightCalculated);
}
internal void OnRowDetailsChanged()
{
if (!_scrollingByHeight)
{
// Update layout when RowDetails are expanded or collapsed, just updating the vertical scroll bar is not enough
// since rows could be added or removed.
InvalidateMeasure();
}
}
internal void OnUserSorting()
{
_isUserSorting = true;
}
internal void OnUserSorted()
{
_isUserSorting = false;
}
internal bool ProcessDownKey()
{
bool shift, ctrl;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return ProcessDownKeyInternal(shift, ctrl);
}
internal bool ProcessEndKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessEndKey(shift, ctrl);
}
internal bool ProcessEnterKey()
{
bool ctrl, shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessEnterKey(shift, ctrl);
}
internal bool ProcessHomeKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessHomeKey(shift, ctrl);
}
internal void ProcessHorizontalScroll(ScrollEventType scrollEventType)
{
if (scrollEventType == ScrollEventType.EndScroll)
{
this.IsHorizontalScrollBarInteracting = false;
}
else if (scrollEventType == ScrollEventType.ThumbTrack)
{
this.IsHorizontalScrollBarInteracting = true;
}
if (_horizontalScrollChangesIgnored > 0)
{
return;
}
// If the user scrolls with the buttons, we need to update the new value of the scroll bar since we delay
// this calculation. If they scroll in another other way, the scroll bar's correct value has already been set
double scrollBarValueDifference = 0;
if (scrollEventType == ScrollEventType.SmallIncrement)
{
scrollBarValueDifference = GetHorizontalSmallScrollIncrease();
}
else if (scrollEventType == ScrollEventType.SmallDecrement)
{
scrollBarValueDifference = -GetHorizontalSmallScrollDecrease();
}
_horizontalScrollChangesIgnored++;
try
{
if (scrollBarValueDifference != 0)
{
DiagnosticsDebug.Assert(_horizontalOffset + scrollBarValueDifference >= 0, "Expected positive _horizontalOffset + scrollBarValueDifference.");
SetHorizontalOffset(_horizontalOffset + scrollBarValueDifference);
}
UpdateHorizontalOffset(_hScrollBar.Value);
}
finally
{
_horizontalScrollChangesIgnored--;
}
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationScrollEvents();
}
}
internal bool ProcessLeftKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessLeftKey(shift, ctrl);
}
internal bool ProcessNextKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessNextKey(shift, ctrl);
}
internal bool ProcessPriorKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessPriorKey(shift, ctrl);
}
internal bool ProcessRightKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessRightKey(shift, ctrl);
}
internal bool ProcessScrollOffsetDelta(double offsetDelta, bool isForHorizontalScroll)
{
if (this.IsEnabled && this.DisplayData.NumDisplayedScrollingElements > 0)
{
if (isForHorizontalScroll)
{
double newHorizontalOffset = this.HorizontalOffset + offsetDelta;
if (newHorizontalOffset < 0)
{
newHorizontalOffset = 0;
}
double maxHorizontalOffset = Math.Max(0, this.ColumnsInternal.VisibleEdgedColumnsWidth - this.CellsWidth);
if (newHorizontalOffset > maxHorizontalOffset)
{
newHorizontalOffset = maxHorizontalOffset;
}
if (newHorizontalOffset != this.HorizontalOffset)
{
UpdateHorizontalOffset(newHorizontalOffset);
return true;
}
}
else
{
if (offsetDelta < 0)
{
offsetDelta = Math.Max(-_verticalOffset, offsetDelta);
}
else if (offsetDelta > 0)
{
if (_vScrollBar != null && this.VerticalScrollBarVisibility == ScrollBarVisibility.Visible)
{
offsetDelta = Math.Min(Math.Max(0, _vScrollBar.Maximum - _verticalOffset), offsetDelta);
}
else
{
double maximum = this.EdgedRowsHeightCalculated - this.CellsHeight;
offsetDelta = Math.Min(Math.Max(0, maximum - _verticalOffset), offsetDelta);
}
}
if (offsetDelta != 0)
{
this.DisplayData.PendingVerticalScrollHeight = offsetDelta;
InvalidateRowsMeasure(false /*invalidateIndividualRows*/);
return true;
}
}
}
return false;
}
/// <summary>
/// Selects items and updates currency based on parameters
/// </summary>
/// <param name="columnIndex">column index to make current</param>
/// <param name="item">data item or CollectionViewGroup to make current</param>
/// <param name="backupSlot">slot to use in case the item is no longer valid</param>
/// <param name="action">selection action to perform</param>
/// <param name="scrollIntoView">whether or not the new current item should be scrolled into view</param>
internal void ProcessSelectionAndCurrency(int columnIndex, object item, int backupSlot, DataGridSelectionAction action, bool scrollIntoView)
{
_noSelectionChangeCount++;
_noCurrentCellChangeCount++;
try
{
int slot = -1;
ICollectionViewGroup group = item as ICollectionViewGroup;
if (group != null)
{
DataGridRowGroupInfo groupInfo = this.RowGroupInfoFromCollectionViewGroup(group);
if (groupInfo != null)
{
slot = groupInfo.Slot;
}
}
else
{
slot = this.SlotFromRowIndex(this.DataConnection.IndexOf(item));
}
if (slot == -1)
{
slot = backupSlot;
}
if (slot < 0 || slot > this.SlotCount)
{
return;
}
switch (action)
{
case DataGridSelectionAction.AddCurrentToSelection:
SetRowSelection(slot, true /*isSelected*/, true /*setAnchorIndex*/);
break;
case DataGridSelectionAction.RemoveCurrentFromSelection:
SetRowSelection(slot, false /*isSelected*/, false /*setAnchorRowIndex*/);
break;
case DataGridSelectionAction.SelectFromAnchorToCurrent:
if (this.SelectionMode == DataGridSelectionMode.Extended && this.AnchorSlot != -1)
{
int anchorSlot = this.AnchorSlot;
ClearRowSelection(slot /*slotException*/, false /*resetAnchorSlot*/);
if (slot <= anchorSlot)
{
SetRowsSelection(slot, anchorSlot);
}
else
{
SetRowsSelection(anchorSlot, slot);
}
}
else
{
goto case DataGridSelectionAction.SelectCurrent;
}
break;
case DataGridSelectionAction.SelectCurrent:
ClearRowSelection(slot /*rowIndexException*/, true /*setAnchorRowIndex*/);
break;
case DataGridSelectionAction.None:
break;
}
if (this.CurrentSlot != slot || (this.CurrentColumnIndex != columnIndex && columnIndex != -1))
{
if (columnIndex == -1)
{
if (this.CurrentColumnIndex != -1)
{
columnIndex = this.CurrentColumnIndex;
}
else
{
DataGridColumn firstVisibleColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
if (firstVisibleColumn != null)
{
columnIndex = firstVisibleColumn.Index;
}
}
}
if (columnIndex != -1)
{
if (!SetCurrentCellCore(columnIndex, slot, true /*commitEdit*/, SlotFromRowIndex(this.SelectedIndex) != slot /*endRowEdit*/)
|| (scrollIntoView && !ScrollSlotIntoView(columnIndex, slot, true /*forCurrentCellChange*/, false /*forceHorizontalScroll*/)))
{
return;
}
}
}
_successfullyUpdatedSelection = true;
}
finally
{
this.NoCurrentCellChangeCount--;
this.NoSelectionChangeCount--;
}
}
internal bool ProcessUpKey()
{
bool ctrl;
bool shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessUpKey(shift, ctrl);
}
internal void ProcessVerticalScroll(ScrollEventType scrollEventType)
{
if (scrollEventType == ScrollEventType.EndScroll)
{
this.IsVerticalScrollBarInteracting = false;
}
else if (scrollEventType == ScrollEventType.ThumbTrack)
{
this.IsVerticalScrollBarInteracting = true;
}
if (_verticalScrollChangesIgnored > 0)
{
return;
}
DiagnosticsDebug.Assert(DoubleUtil.LessThanOrClose(_vScrollBar.Value, _vScrollBar.Maximum), "Expected _vScrollBar.Value smaller than or close to _vScrollBar.Maximum.");
_verticalScrollChangesIgnored++;
try
{
DiagnosticsDebug.Assert(_vScrollBar != null, "Expected non-null _vScrollBar.");
if (scrollEventType == ScrollEventType.SmallIncrement)
{
this.DisplayData.PendingVerticalScrollHeight = GetVerticalSmallScrollIncrease();
double newVerticalOffset = _verticalOffset + this.DisplayData.PendingVerticalScrollHeight;
if (newVerticalOffset > _vScrollBar.Maximum)
{
this.DisplayData.PendingVerticalScrollHeight -= newVerticalOffset - _vScrollBar.Maximum;
}
}
else if (scrollEventType == ScrollEventType.SmallDecrement)
{
if (DoubleUtil.GreaterThan(this.NegVerticalOffset, 0))
{
this.DisplayData.PendingVerticalScrollHeight -= this.NegVerticalOffset;
}
else
{
int previousScrollingSlot = this.GetPreviousVisibleSlot(this.DisplayData.FirstScrollingSlot);
if (previousScrollingSlot >= 0)
{
ScrollSlotIntoView(previousScrollingSlot, false /*scrolledHorizontally*/);
}
return;
}
}
else
{
this.DisplayData.PendingVerticalScrollHeight = _vScrollBar.Value - _verticalOffset;
}
if (!DoubleUtil.IsZero(this.DisplayData.PendingVerticalScrollHeight))
{
// Invalidate so the scroll happens on idle
InvalidateRowsMeasure(false /*invalidateIndividualElements*/);
}
}
finally
{
_verticalScrollChangesIgnored--;
}
}
internal void RefreshRowsAndColumns(bool clearRows)
{
if (_measured)
{
try
{
_noCurrentCellChangeCount++;
if (clearRows)
{
ClearRows(false);
ClearRowGroupHeadersTable();
PopulateRowGroupHeadersTable();
RefreshSlotCounts();
}
if (this.AutoGenerateColumns)
{
// Column auto-generation refreshes the rows too
AutoGenerateColumnsPrivate();
}
foreach (DataGridColumn column in this.ColumnsItemsInternal)
{
// We don't need to refresh the state of AutoGenerated column headers because they're up-to-date
if (!column.IsAutoGenerated && column.HasHeaderCell)
{
column.HeaderCell.ApplyState(false);
}
}
RefreshRows(false /*recycleRows*/, false /*clearRows*/);
if (this.Columns.Count > 0 && this.CurrentColumnIndex == -1)
{
MakeFirstDisplayedCellCurrentCell();
}
else
{
_makeFirstDisplayedCellCurrentCellPending = false;
_desiredCurrentColumnIndex = -1;
FlushCurrentCellChanged();
}
}
finally
{
this.NoCurrentCellChangeCount--;
}
}
else
{
if (clearRows)
{
ClearRows(false /*recycle*/);
}
ClearRowGroupHeadersTable();
PopulateRowGroupHeadersTable();
RefreshSlotCounts();
}
}
internal void ResetColumnHeaderInteractionInfo()
{
DataGridColumnHeaderInteractionInfo interactionInfo = this.ColumnHeaderInteractionInfo;
if (interactionInfo != null)
{
interactionInfo.CapturedPointer = null;
interactionInfo.DragMode = DataGridColumnHeader.DragMode.None;
interactionInfo.DragPointerId = 0;
interactionInfo.DragColumn = null;
interactionInfo.DragStart = null;
interactionInfo.PressedPointerPositionHeaders = null;
interactionInfo.LastPointerPositionHeaders = null;
}
if (this.ColumnHeaders != null)
{
this.ColumnHeaders.DragColumn = null;
this.ColumnHeaders.DragIndicator = null;
this.ColumnHeaders.DropLocationIndicator = null;
}
}
internal bool ScrollSlotIntoView(int columnIndex, int slot, bool forCurrentCellChange, bool forceHorizontalScroll)
{
DiagnosticsDebug.Assert(columnIndex >= 0, "Expected positive columnIndex.");
DiagnosticsDebug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol >= -1, "Expected DisplayData.FirstDisplayedScrollingCol greater than or equal to -1.");
DiagnosticsDebug.Assert(this.DisplayData.FirstDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol >= -1, "Expected DisplayData.LastTotallyDisplayedScrollingCol greater than or equal to -1.");
DiagnosticsDebug.Assert(this.DisplayData.LastTotallyDisplayedScrollingCol < this.ColumnsItemsInternal.Count, "Expected DisplayData.LastTotallyDisplayedScrollingCol smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(!IsSlotOutOfBounds(slot), "Expected IsSlotOutOfBounds(slot) is false.");
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot >= -1, "Expected DisplayData.FirstScrollingSlot greater than or equal to -1.");
DiagnosticsDebug.Assert(this.DisplayData.FirstScrollingSlot < this.SlotCount, "Expected DisplayData.FirstScrollingSlot smaller than SlotCount.");
DiagnosticsDebug.Assert(this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected ColumnsItemsInternal[columnIndex].IsVisible is true.");
if (this.CurrentColumnIndex >= 0 &&
(this.CurrentColumnIndex != columnIndex || this.CurrentSlot != slot))
{
if (!CommitEditForOperation(columnIndex, slot, forCurrentCellChange) || IsInnerCellOutOfBounds(columnIndex, slot))
{
return false;
}
}
double oldHorizontalOffset = this.HorizontalOffset;
bool rowGroupHeadersTableContainsSlot = this.RowGroupHeadersTable.Contains(slot);
// scroll horizontally unless we're on a RowGroupHeader and we're not forcing horizontal scrolling
if ((forceHorizontalScroll || (slot != -1 && !rowGroupHeadersTableContainsSlot)) &&
!ScrollColumnIntoView(columnIndex))
{
return false;
}
// scroll vertically
if (!ScrollSlotIntoView(slot, oldHorizontalOffset != this.HorizontalOffset /*scrolledHorizontally*/))
{
return false;
}
// Scrolling horizontally or vertically could cause less rows to be displayed
this.DisplayData.FullyRecycleElements();
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationScrollEvents();
}
return true;
}
// Convenient overload that commits the current edit.
internal bool SetCurrentCellCore(int columnIndex, int slot)
{
return SetCurrentCellCore(columnIndex, slot, true /*commitEdit*/, true /*endRowEdit*/);
}
internal void UpdateHorizontalOffset(double newValue)
{
if (this.HorizontalOffset != newValue)
{
this.HorizontalOffset = newValue;
InvalidateColumnHeadersMeasure();
InvalidateRowsMeasure(true);
}
}
internal bool UpdateSelectionAndCurrency(int columnIndex, int slot, DataGridSelectionAction action, bool scrollIntoView)
{
_successfullyUpdatedSelection = false;
_noSelectionChangeCount++;
_noCurrentCellChangeCount++;
try
{
if (this.ColumnsInternal.RowGroupSpacerColumn.IsRepresented &&
columnIndex == this.ColumnsInternal.RowGroupSpacerColumn.Index)
{
columnIndex = -1;
}
if (IsSlotOutOfSelectionBounds(slot) || (columnIndex != -1 && IsColumnOutOfBounds(columnIndex)))
{
return false;
}
int newCurrentPosition = -1;
object item = ItemFromSlot(slot, ref newCurrentPosition);
if (newCurrentPosition == this.DataConnection.NewItemPlaceholderIndex)
{
newCurrentPosition = -1;
}
if (this.EditingRow != null && slot != this.EditingRow.Slot && !CommitEdit(DataGridEditingUnit.Row, true))
{
return false;
}
if (this.DataConnection.CollectionView != null &&
this.DataConnection.CollectionView.CurrentPosition != newCurrentPosition)
{
this.DataConnection.MoveCurrentTo(item, slot, columnIndex, action, scrollIntoView);
}
else
{
this.ProcessSelectionAndCurrency(columnIndex, item, slot, action, scrollIntoView);
}
}
finally
{
this.NoCurrentCellChangeCount--;
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
internal void UpdateStateOnCurrentChanged(object currentItem, int currentPosition)
{
if ((currentItem == this.CurrentItem) &&
(_isUserSorting || (currentItem == this.SelectedItem && currentPosition == this.SelectedIndex)))
{
// The DataGrid's CurrentItem is already up-to-date, so we don't need to do anything.
// In the sorting case, we receive a CurrentChanged notification if the current item
// changes position in the CollectionView. However, our CurrentItem is already
// in the correct position in this case, and we do not want to update the selection so
// we no-op here.
return;
}
int columnIndex = this.CurrentColumnIndex;
if (columnIndex == -1)
{
if (this.IsColumnOutOfBounds(_desiredCurrentColumnIndex))
{
columnIndex = this.FirstDisplayedNonFillerColumnIndex;
}
else if (this.ColumnsInternal.RowGroupSpacerColumn.IsRepresented && _desiredCurrentColumnIndex == this.ColumnsInternal.RowGroupSpacerColumn.Index)
{
columnIndex = this.FirstDisplayedNonFillerColumnIndex;
}
else
{
columnIndex = _desiredCurrentColumnIndex;
}
}
// The CollectionView will potentially raise multiple CurrentChanged events during a single
// add operation, so we should avoid resetting our desired column index until it's committed.
if (!this.DataConnection.IsAddingNew)
{
_desiredCurrentColumnIndex = -1;
}
try
{
_noSelectionChangeCount++;
_noCurrentCellChangeCount++;
if (!this.CommitEdit())
{
this.CancelEdit(DataGridEditingUnit.Row, false);
}
this.ClearRowSelection(true);
if (currentItem == null)
{
SetCurrentCellCore(-1, -1);
}
else
{
int slot = SlotFromRowIndex(currentPosition);
this.ProcessSelectionAndCurrency(columnIndex, currentItem, slot, DataGridSelectionAction.SelectCurrent, false);
}
}
finally
{
this.NoCurrentCellChangeCount--;
this.NoSelectionChangeCount--;
}
}
internal bool UpdateStateOnTapped(TappedRoutedEventArgs args, int columnIndex, int slot, bool allowEdit)
{
bool ctrl, shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.UpdateStateOnTapped(args, columnIndex, slot, allowEdit, shift, ctrl);
}
internal void UpdateVerticalScrollBar()
{
if (_vScrollBar != null && _vScrollBar.Visibility == Visibility.Visible)
{
double cellsHeight = this.CellsHeight;
double edgedRowsHeightCalculated = this.EdgedRowsHeightCalculated;
UpdateVerticalScrollBar(
edgedRowsHeightCalculated > cellsHeight /*needVertScrollBar*/,
this.VerticalScrollBarVisibility == ScrollBarVisibility.Visible /*forceVertScrollBar*/,
edgedRowsHeightCalculated,
cellsHeight);
}
}
/// <summary>
/// If the editing element has focus, this method will set focus to the DataGrid itself
/// in order to force the element to lose focus. It will then wait for the editing element's
/// LostFocus event, at which point it will perform the specified action.
/// NOTE: It is important to understand that the specified action will be performed when the editing
/// element loses focus only if this method returns true. If it returns false, then the action
/// will not be performed later on, and should instead be performed by the caller, if necessary.
/// </summary>
/// <param name="action">Action to perform after the editing element loses focus</param>
/// <returns>True if the editing element had focus and the action was cached away; false otherwise</returns>
internal bool WaitForLostFocus(Action action)
{
if (this.EditingRow != null && this.EditingColumnIndex != -1 && !_executingLostFocusActions)
{
DataGridColumn editingColumn = this.ColumnsItemsInternal[this.EditingColumnIndex];
FrameworkElement editingElement = editingColumn.GetCellContent(this.EditingRow);
if (editingElement != null && editingElement.ContainsChild(_focusedObject))
{
DiagnosticsDebug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
_lostFocusActions.Enqueue(action);
editingElement.LostFocus += new RoutedEventHandler(EditingElement_LostFocus);
this.IsTabStop = true;
this.Focus(FocusState.Programmatic);
return true;
}
}
return false;
}
// Applies the given Style to the Row if it's supposed to use DataGrid.RowStyle
private static void EnsureElementStyle(FrameworkElement element, Style oldDataGridStyle, Style newDataGridStyle)
{
DiagnosticsDebug.Assert(element != null, "Expected non-null element.");
// Apply the DataGrid style if the row was using the old DataGridRowStyle before
if (element != null && (element.Style == null || element.Style == oldDataGridStyle))
{
element.SetStyleWithType(newDataGridStyle);
}
}
private bool AddNewItem(RoutedEventArgs editingEventArgs)
{
#if FEATURE_IEDITABLECOLLECTIONVIEW
if (this.DataConnection.EditableCollectionView != null && this.DataConnection.EditableCollectionView.CanAddNew)
{
_desiredCurrentColumnIndex = this.CurrentColumnIndex;
object addItem = this.DataConnection.EditableCollectionView.AddNew();
if (this.CurrentItem != this.DataConnection.EditableCollectionView.CurrentAddItem)
{
int newItemSlot = SlotFromRowIndex(this.DataConnection.IndexOf(addItem));
SetAndSelectCurrentCell(this.CurrentColumnIndex, newItemSlot, true);
if (!_successfullyUpdatedSelection)
{
return false;
}
}
return BeginCellEdit(editingEventArgs);
}
#endif
return false;
}
private void AddNewCellPrivate(DataGridRow row, DataGridColumn column)
{
DataGridCell newCell = new DataGridCell();
PopulateCellContent(false /*isCellEdited*/, column, row, newCell);
if (row.OwningGrid != null)
{
newCell.OwningColumn = column;
newCell.Visibility = column.Visibility;
}
if (column is DataGridFillerColumn)
{
Windows.UI.Xaml.Automation.AutomationProperties.SetAccessibilityView(
newCell,
AccessibilityView.Raw);
}
newCell.EnsureStyle(null);
row.Cells.Insert(column.Index, newCell);
}
// TODO: Call this method once the UISettings has a public property for the "Automatically hide scroll bars in Windows" setting
// private void AutoHideScrollBarsChanged()
// {
// if (UISettingsHelper.AreSettingsAutoHidingScrollBars)
// {
// SwitchScrollBarsVisualStates(_proposedScrollBarsState, _proposedScrollBarsSeparatorState, true /*useTransitions*/);
// }
// else
// {
// if (this.AreBothScrollBarsVisible)
// {
// if (UISettingsHelper.AreSettingsEnablingAnimations)
// {
// SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicatorFull, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorExpanded : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
// }
// else
// {
// SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicatorFull, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorExpandedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
// }
// }
// else
// {
// if (UISettingsHelper.AreSettingsEnablingAnimations)
// {
// SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicator, ScrollBarsSeparatorVisualState.SeparatorCollapsed, true/*useTransitions*/);
// }
// else
// {
// SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicator, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
// }
// }
// }
// }
private bool BeginCellEdit(RoutedEventArgs editingEventArgs)
{
if (this.CurrentColumnIndex == -1 || !GetRowSelection(this.CurrentSlot))
{
return false;
}
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot, "Expected null EditingRow or EditingRow.Slot equal to CurrentSlot.");
DiagnosticsDebug.Assert(!GetColumnEffectiveReadOnlyState(this.CurrentColumn), "Expected GetColumnEffectiveReadOnlyState(CurrentColumn) is false.");
DiagnosticsDebug.Assert(this.CurrentColumn.IsVisible, "Expected CurrentColumn.IsVisible is true.");
if (_editingColumnIndex != -1)
{
// Current cell is already in edit mode
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
return true;
}
// When we begin edit on the NewItemPlaceHolder row, we should try to add a new item.
if (this.CurrentSlot == SlotFromRowIndex(this.DataConnection.NewItemPlaceholderIndex))
{
return this.AddNewItem(editingEventArgs);
}
// Get or generate the editing row if it doesn't exist
DataGridRow dataGridRow = this.EditingRow;
if (dataGridRow == null)
{
DiagnosticsDebug.Assert(!this.RowGroupHeadersTable.Contains(this.CurrentSlot), "Expected CurrentSlot not contained in RowGroupHeadersTable.");
if (this.IsSlotVisible(this.CurrentSlot))
{
dataGridRow = this.DisplayData.GetDisplayedElement(this.CurrentSlot) as DataGridRow;
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
}
else
{
dataGridRow = GenerateRow(RowIndexFromSlot(this.CurrentSlot), this.CurrentSlot);
dataGridRow.Clip = new RectangleGeometry();
}
if (this.DataConnection.IsAddingNew)
{
// We just began editing the new item row, so set a flag that prevents us from running
// full entity validation until the user explicitly attempts to end editing the row.
_initializingNewItem = true;
}
}
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
// Cache these to see if they change later
int currentRowIndex = this.CurrentSlot;
int currentColumnIndex = this.CurrentColumnIndex;
// Raise the BeginningEdit event
DataGridCell dataGridCell = dataGridRow.Cells[this.CurrentColumnIndex];
DataGridBeginningEditEventArgs e = new DataGridBeginningEditEventArgs(this.CurrentColumn, dataGridRow, editingEventArgs);
OnBeginningEdit(e);
if (e.Cancel ||
currentRowIndex != this.CurrentSlot ||
currentColumnIndex != this.CurrentColumnIndex ||
!GetRowSelection(this.CurrentSlot) ||
(this.EditingRow == null && !BeginRowEdit(dataGridRow)))
{
// If either BeginningEdit was canceled, currency/selection was changed in the event handler,
// or we failed opening the row for edit, then we can no longer continue BeginCellEdit
return false;
}
if (this.EditingRow == null || this.EditingRow.Slot != this.CurrentSlot)
{
// This check was added to safeguard against a ListCollectionView bug where the collection changed currency
// during a CommitNew operation but failed to raise a CurrentChanged event.
return false;
}
// Finally, we can prepare the cell for editing
_editingColumnIndex = this.CurrentColumnIndex;
_editingEventArgs = editingEventArgs;
this.EditingRow.Cells[this.CurrentColumnIndex].ApplyCellState(true /*animate*/);
PopulateCellContent(true /*isCellEdited*/, this.CurrentColumn, dataGridRow, dataGridCell);
return true;
}
private bool BeginRowEdit(DataGridRow dataGridRow)
{
DiagnosticsDebug.Assert(this.EditingRow == null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
if (this.DataConnection.BeginEdit(dataGridRow.DataContext))
{
this.EditingRow = dataGridRow;
this.GenerateEditingElements();
this.ValidateEditingRow(false /*scrollIntoView*/, true /*wireEvents*/);
// Raise the automation invoke event for the row that just began edit
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
{
peer.RaiseAutomationInvokeEvents(DataGridEditingUnit.Row, null, dataGridRow);
}
return true;
}
return false;
}
private bool CancelRowEdit(bool exitEditingMode)
{
if (this.EditingRow == null)
{
return true;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow greater or equal to -1.");
DiagnosticsDebug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow smaller than SlotCount.");
DiagnosticsDebug.Assert(this.CurrentColumn != null, "Expected non-null CurrentColumn.");
object dataItem = this.EditingRow.DataContext;
if (!this.DataConnection.CancelEdit(dataItem))
{
return false;
}
foreach (DataGridColumn column in this.Columns)
{
if (!exitEditingMode && column.Index == _editingColumnIndex && column is DataGridBoundColumn)
{
continue;
}
PopulateCellContent(!exitEditingMode && column.Index == _editingColumnIndex /*isCellEdited*/, column, this.EditingRow, this.EditingRow.Cells[column.Index]);
}
return true;
}
private bool CommitEditForOperation(int columnIndex, int slot, bool forCurrentCellChange)
{
if (forCurrentCellChange)
{
if (!EndCellEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, true /*keepFocus*/, true /*raiseEvents*/))
{
return false;
}
if (this.CurrentSlot != slot &&
!EndRowEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, true /*raiseEvents*/))
{
return false;
}
}
if (IsColumnOutOfBounds(columnIndex))
{
return false;
}
if (slot >= this.SlotCount)
{
// Current cell was reset because the commit deleted row(s).
// Since the user wants to change the current cell, we don't
// want to end up with no current cell. We pick the last row
// in the grid which may be the 'new row'.
int lastSlot = this.LastVisibleSlot;
if (forCurrentCellChange &&
this.CurrentColumnIndex == -1 &&
lastSlot != -1)
{
SetAndSelectCurrentCell(columnIndex, lastSlot, false /*forceCurrentCellSelection (unused here)*/);
}
// Interrupt operation because it has become invalid.
return false;
}
return true;
}
private bool CommitRowEdit(bool exitEditingMode)
{
if (this.EditingRow == null)
{
return true;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Index >= -1, "Expected EditingRow.Index greater than or equal to -1.");
DiagnosticsDebug.Assert(this.EditingRow.Slot < this.SlotCount, "Expected EditingRow.Slot smaller than SlotCount.");
if (!ValidateEditingRow(true /*scrollIntoView*/, false /*wireEvents*/))
{
return false;
}
this.DataConnection.EndEdit(this.EditingRow.DataContext);
if (!exitEditingMode)
{
this.DataConnection.BeginEdit(this.EditingRow.DataContext);
}
return true;
}
private void CompleteCellsCollection(DataGridRow dataGridRow)
{
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
int cellsInCollection = dataGridRow.Cells.Count;
if (this.ColumnsItemsInternal.Count > cellsInCollection)
{
for (int columnIndex = cellsInCollection; columnIndex < this.ColumnsItemsInternal.Count; columnIndex++)
{
AddNewCellPrivate(dataGridRow, this.ColumnsItemsInternal[columnIndex]);
}
}
}
private void ComputeScrollBarsLayout()
{
if (_ignoreNextScrollBarsLayout)
{
_ignoreNextScrollBarsLayout = false;
// TODO: This optimization is causing problems with initial layout:
// Investigate why horizontal ScrollBar sometimes has incorrect thumb size when
// it first appears after adding a row when this perf improvement is turned on.
// return;
}
bool isHorizontalScrollBarOverCells = this.IsHorizontalScrollBarOverCells;
bool isVerticalScrollBarOverCells = this.IsVerticalScrollBarOverCells;
double cellsWidth = this.CellsWidth;
double cellsHeight = this.CellsHeight;
bool allowHorizScrollBar = false;
bool forceHorizScrollBar = false;
double horizScrollBarHeight = 0;
if (_hScrollBar != null)
{
forceHorizScrollBar = this.HorizontalScrollBarVisibility == ScrollBarVisibility.Visible;
allowHorizScrollBar = forceHorizScrollBar || (this.ColumnsInternal.VisibleColumnCount > 0 &&
this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled &&
this.HorizontalScrollBarVisibility != ScrollBarVisibility.Hidden);
// Compensate if the horizontal scrollbar is already taking up space
if (!forceHorizScrollBar && _hScrollBar.Visibility == Visibility.Visible)
{
if (!isHorizontalScrollBarOverCells)
{
cellsHeight += _hScrollBar.DesiredSize.Height;
}
}
if (!isHorizontalScrollBarOverCells)
{
horizScrollBarHeight = _hScrollBar.Height + _hScrollBar.Margin.Top + _hScrollBar.Margin.Bottom;
}
}
bool allowVertScrollBar = false;
bool forceVertScrollBar = false;
double vertScrollBarWidth = 0;
if (_vScrollBar != null)
{
forceVertScrollBar = this.VerticalScrollBarVisibility == ScrollBarVisibility.Visible;
allowVertScrollBar = forceVertScrollBar || (this.ColumnsItemsInternal.Count > 0 &&
this.VerticalScrollBarVisibility != ScrollBarVisibility.Disabled &&
this.VerticalScrollBarVisibility != ScrollBarVisibility.Hidden);
// Compensate if the vertical scrollbar is already taking up space
if (!forceVertScrollBar && _vScrollBar.Visibility == Visibility.Visible)
{
if (!isVerticalScrollBarOverCells)
{
cellsWidth += _vScrollBar.DesiredSize.Width;
}
}
if (!isVerticalScrollBarOverCells)
{
vertScrollBarWidth = _vScrollBar.Width + _vScrollBar.Margin.Left + _vScrollBar.Margin.Right;
}
}
// Now cellsWidth is the width potentially available for displaying data cells.
// Now cellsHeight is the height potentially available for displaying data cells.
bool needHorizScrollBar = false;
bool needVertScrollBar = false;
double totalVisibleWidth = this.ColumnsInternal.VisibleEdgedColumnsWidth;
double totalVisibleFrozenWidth = this.ColumnsInternal.GetVisibleFrozenEdgedColumnsWidth();
UpdateDisplayedRows(this.DisplayData.FirstScrollingSlot, this.CellsHeight);
double totalVisibleHeight = this.EdgedRowsHeightCalculated;
if (!forceHorizScrollBar && !forceVertScrollBar)
{
bool needHorizScrollBarWithoutVertScrollBar = false;
if (allowHorizScrollBar &&
DoubleUtil.GreaterThan(totalVisibleWidth, cellsWidth) &&
DoubleUtil.LessThan(totalVisibleFrozenWidth, cellsWidth) &&
DoubleUtil.LessThanOrClose(horizScrollBarHeight, cellsHeight))
{
double oldDataHeight = cellsHeight;
cellsHeight -= horizScrollBarHeight;
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
needHorizScrollBarWithoutVertScrollBar = needHorizScrollBar = true;
if (vertScrollBarWidth > 0 &&
allowVertScrollBar &&
(DoubleUtil.LessThanOrClose(totalVisibleWidth - cellsWidth, vertScrollBarWidth) || DoubleUtil.LessThanOrClose(cellsWidth - totalVisibleFrozenWidth, vertScrollBarWidth)))
{
// Would we still need a horizontal scrollbar without the vertical one?
UpdateDisplayedRows(this.DisplayData.FirstScrollingSlot, cellsHeight);
if (this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
{
needHorizScrollBar = DoubleUtil.LessThan(totalVisibleFrozenWidth, cellsWidth - vertScrollBarWidth);
}
if (!needHorizScrollBar)
{
// Restore old data height because turns out a horizontal scroll bar wouldn't make sense
cellsHeight = oldDataHeight;
}
}
}
// Store the current FirstScrollingSlot because removing the horizontal scrollbar could scroll
// the DataGrid up; however, if we realize later that we need to keep the horizontal scrollbar
// then we should use the first slot stored here which is not scrolled.
int firstScrollingSlot = this.DisplayData.FirstScrollingSlot;
UpdateDisplayedRows(firstScrollingSlot, cellsHeight);
if (allowVertScrollBar &&
DoubleUtil.GreaterThan(cellsHeight, 0) &&
DoubleUtil.LessThanOrClose(vertScrollBarWidth, cellsWidth) &&
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
{
cellsWidth -= vertScrollBarWidth;
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
needVertScrollBar = true;
}
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
// We compute the number of visible columns only after we set up the vertical scroll bar.
ComputeDisplayedColumns();
if ((vertScrollBarWidth > 0 || horizScrollBarHeight > 0) &&
allowHorizScrollBar &&
needVertScrollBar && !needHorizScrollBar &&
DoubleUtil.GreaterThan(totalVisibleWidth, cellsWidth) &&
DoubleUtil.LessThan(totalVisibleFrozenWidth, cellsWidth) &&
DoubleUtil.LessThanOrClose(horizScrollBarHeight, cellsHeight))
{
cellsWidth += vertScrollBarWidth;
cellsHeight -= horizScrollBarHeight;
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
needVertScrollBar = false;
UpdateDisplayedRows(firstScrollingSlot, cellsHeight);
if (cellsHeight > 0 &&
vertScrollBarWidth <= cellsWidth &&
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
{
cellsWidth -= vertScrollBarWidth;
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
needVertScrollBar = true;
}
if (needVertScrollBar)
{
needHorizScrollBar = true;
}
else
{
needHorizScrollBar = needHorizScrollBarWithoutVertScrollBar;
}
}
}
else if (forceHorizScrollBar && !forceVertScrollBar)
{
if (allowVertScrollBar)
{
if (cellsHeight > 0 &&
DoubleUtil.LessThanOrClose(vertScrollBarWidth, cellsWidth) &&
this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount)
{
cellsWidth -= vertScrollBarWidth;
DiagnosticsDebug.Assert(cellsWidth >= 0, "Expected positive cellsWidth.");
needVertScrollBar = true;
}
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
ComputeDisplayedColumns();
}
needHorizScrollBar = totalVisibleWidth > cellsWidth && totalVisibleFrozenWidth < cellsWidth;
}
else if (!forceHorizScrollBar && forceVertScrollBar)
{
if (allowHorizScrollBar)
{
if (cellsWidth > 0 &&
DoubleUtil.LessThanOrClose(horizScrollBarHeight, cellsHeight) &&
DoubleUtil.GreaterThan(totalVisibleWidth, cellsWidth) &&
DoubleUtil.LessThan(totalVisibleFrozenWidth, cellsWidth))
{
cellsHeight -= horizScrollBarHeight;
DiagnosticsDebug.Assert(cellsHeight >= 0, "Expected positive cellsHeight.");
needHorizScrollBar = true;
UpdateDisplayedRows(this.DisplayData.FirstScrollingSlot, cellsHeight);
}
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
ComputeDisplayedColumns();
}
needVertScrollBar = this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount;
}
else
{
DiagnosticsDebug.Assert(forceHorizScrollBar, "Expected forceHorizScrollBar is true.");
DiagnosticsDebug.Assert(forceVertScrollBar, "Expected forceVertScrollBar is true.");
DiagnosticsDebug.Assert(allowHorizScrollBar, "Expected allowHorizScrollBar is true.");
DiagnosticsDebug.Assert(allowVertScrollBar, "Expected allowVertScrollBar is true.");
this.DisplayData.FirstDisplayedScrollingCol = ComputeFirstVisibleScrollingColumn();
ComputeDisplayedColumns();
needVertScrollBar = this.DisplayData.NumTotallyDisplayedScrollingElements != this.VisibleSlotCount;
needHorizScrollBar = totalVisibleWidth > cellsWidth && totalVisibleFrozenWidth < cellsWidth;
}
UpdateHorizontalScrollBar(needHorizScrollBar, forceHorizScrollBar, totalVisibleWidth, totalVisibleFrozenWidth, cellsWidth);
UpdateVerticalScrollBar(needVertScrollBar, forceVertScrollBar, totalVisibleHeight, cellsHeight);
if (_topRightCornerHeader != null)
{
// Show the TopRightHeaderCell based on vertical ScrollBar visibility
if (this.AreColumnHeadersVisible &&
_vScrollBar != null && _vScrollBar.Visibility == Visibility.Visible)
{
_topRightCornerHeader.Visibility = Visibility.Visible;
}
else
{
_topRightCornerHeader.Visibility = Visibility.Collapsed;
}
}
if (_bottomRightCorner != null)
{
// Show the BottomRightCorner when both scrollbars are visible.
_bottomRightCorner.Visibility =
_hScrollBar != null && _hScrollBar.Visibility == Visibility.Visible &&
_vScrollBar != null && _vScrollBar.Visibility == Visibility.Visible ?
Visibility.Visible : Visibility.Collapsed;
}
this.DisplayData.FullyRecycleElements();
}
#if FEATURE_VALIDATION_SUMMARY
/// <summary>
/// Create an ValidationSummaryItem for a given ValidationResult, by finding all cells related to the
/// validation error and adding them as separate ValidationSummaryItemSources.
/// </summary>
/// <param name="validationResult">ValidationResult</param>
/// <returns>ValidationSummaryItem</returns>
private ValidationSummaryItem CreateValidationSummaryItem(ValidationResult validationResult)
{
DiagnosticsDebug.Assert(validationResult != null);
DiagnosticsDebug.Assert(_validationSummary != null);
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
ValidationSummaryItem validationSummaryItem = new ValidationSummaryItem(validationResult.ErrorMessage);
validationSummaryItem.Context = validationResult;
string messageHeader = null;
foreach (DataGridColumn column in this.ColumnsInternal.GetDisplayedColumns(c => c.IsVisible && !c.IsReadOnly))
{
foreach (string property in validationResult.MemberNames)
{
if (!string.IsNullOrEmpty(property) && column.BindingPaths.Contains(property))
{
validationSummaryItem.Sources.Add(new ValidationSummaryItemSource(property, this.EditingRow.Cells[column.Index]));
if (string.IsNullOrEmpty(messageHeader) && column.Header != null)
{
messageHeader = column.Header.ToString();
}
}
}
}
DiagnosticsDebug.Assert(validationSummaryItem.ItemType == ValidationSummaryItemType.ObjectError);
if (_propertyValidationResults.ContainsEqualValidationResult(validationResult))
{
validationSummaryItem.MessageHeader = messageHeader;
validationSummaryItem.ItemType = ValidationSummaryItemType.PropertyError;
}
return validationSummaryItem;
}
#endif
/// <summary>
/// Handles the current editing element's LostFocus event by performing any actions that
/// were cached by the WaitForLostFocus method.
/// </summary>
/// <param name="sender">Editing element</param>
/// <param name="e">RoutedEventArgs</param>
private void EditingElement_LostFocus(object sender, RoutedEventArgs e)
{
FrameworkElement editingElement = sender as FrameworkElement;
if (editingElement != null)
{
editingElement.LostFocus -= new RoutedEventHandler(EditingElement_LostFocus);
if (this.EditingRow != null && this.EditingColumnIndex != -1)
{
this.FocusEditingCell(true);
}
DiagnosticsDebug.Assert(_lostFocusActions != null, "Expected non-null _lostFocusActions.");
try
{
_executingLostFocusActions = true;
while (_lostFocusActions.Count > 0)
{
_lostFocusActions.Dequeue()();
}
}
finally
{
_executingLostFocusActions = false;
}
}
}
// Makes sure horizontal layout is updated to reflect any changes that affect it
private void EnsureHorizontalLayout()
{
this.ColumnsInternal.EnsureVisibleEdgedColumnsWidth();
InvalidateColumnHeadersMeasure();
InvalidateRowsMeasure(true);
InvalidateMeasure();
}
/// <summary>
/// Ensures that the RowHeader widths are properly sized and invalidates them if they are not
/// </summary>
/// <returns>True if a RowHeader or RowGroupHeader was invalidated</returns>
private bool EnsureRowHeaderWidth()
{
bool invalidated = false;
if (this.AreRowHeadersVisible)
{
if (this.AreColumnHeadersVisible)
{
EnsureTopLeftCornerHeader();
}
if (_rowsPresenter != null)
{
foreach (UIElement element in _rowsPresenter.Children)
{
DataGridRow row = element as DataGridRow;
if (row != null)
{
// If the RowHeader resulted in a different width the last time it was measured, we need
// to re-measure it
if (row.HeaderCell != null && row.HeaderCell.DesiredSize.Width != this.ActualRowHeaderWidth)
{
row.HeaderCell.InvalidateMeasure();
invalidated = true;
}
}
else
{
DataGridRowGroupHeader groupHeader = element as DataGridRowGroupHeader;
if (groupHeader != null && groupHeader.HeaderCell != null && groupHeader.HeaderCell.DesiredSize.Width != this.ActualRowHeaderWidth)
{
groupHeader.HeaderCell.InvalidateMeasure();
invalidated = true;
}
}
}
if (invalidated)
{
// We need to update the width of the horizontal scrollbar if the rowHeaders' width actually changed
if (this.ColumnsInternal.VisibleStarColumnCount > 0)
{
this.ColumnsInternal.EnsureVisibleEdgedColumnsWidth();
}
InvalidateMeasure();
}
}
}
return invalidated;
}
private void EnsureRowsPresenterVisibility()
{
if (_rowsPresenter != null)
{
// RowCount doesn't need to be considered, doing so might cause extra Visibility changes
_rowsPresenter.Visibility = this.ColumnsInternal.FirstVisibleNonFillerColumn == null ? Visibility.Collapsed : Visibility.Visible;
}
}
private void EnsureTopLeftCornerHeader()
{
if (_topLeftCornerHeader != null)
{
_topLeftCornerHeader.Visibility = this.HeadersVisibility == DataGridHeadersVisibility.All ? Visibility.Visible : Visibility.Collapsed;
if (_topLeftCornerHeader.Visibility == Visibility.Visible)
{
if (!double.IsNaN(this.RowHeaderWidth))
{
// RowHeaderWidth is set explicitly so we should use that
_topLeftCornerHeader.Width = this.RowHeaderWidth;
}
else if (this.VisibleSlotCount > 0)
{
// RowHeaders AutoSize and we have at least 1 row so take the desired width
_topLeftCornerHeader.Width = this.RowHeadersDesiredWidth;
}
}
}
}
#if FEATURE_VALIDATION_SUMMARY
/// <summary>
/// Handles the ValidationSummary's FocusingInvalidControl event and begins edit on the cells
/// that are associated with the selected error.
/// </summary>
/// <param name="sender">ValidationSummary</param>
/// <param name="e">FocusingInvalidControlEventArgs</param>
private void ValidationSummary_FocusingInvalidControl(object sender, FocusingInvalidControlEventArgs e)
{
DiagnosticsDebug.Assert(_validationSummary != null);
if (this.EditingRow == null || this.IsSlotOutOfBounds(this.EditingRow.Slot) || this.EditingRow.Slot == -1 || !ScrollSlotIntoView(this.EditingRow.Slot, false /*scrolledHorizontally*/))
{
return;
}
// We need to focus the DataGrid in case the focused element gets removed when we end edit.
if ((_editingColumnIndex == -1 || (this.Focus(FocusState.Programmatic) && EndCellEdit(DataGridEditAction.Commit, true, true, true)))
&& e.Item != null && e.Target != null && _validationSummary.Errors.Contains(e.Item))
{
DataGridCell cell = e.Target.Control as DataGridCell;
if (cell != null && cell.OwningGrid == this && cell.OwningColumn != null && cell.OwningColumn.IsVisible)
{
DiagnosticsDebug.Assert(cell.ColumnIndex >= 0 && cell.ColumnIndex < this.ColumnsInternal.Count);
// Begin editing the next relevant cell
UpdateSelectionAndCurrency(cell.ColumnIndex, this.EditingRow.Slot, DataGridSelectionAction.None, true /*scrollIntoView*/);
if (_successfullyUpdatedSelection)
{
BeginCellEdit(new RoutedEventArgs());
if (!IsColumnDisplayed(this.CurrentColumnIndex))
{
ScrollColumnIntoView(this.CurrentColumnIndex);
}
}
}
e.Handled = true;
}
}
/// <summary>
/// Handles the ValidationSummary's SelectionChanged event and changes which cells are displayed as invalid.
/// </summary>
/// <param name="sender">ValidationSummary</param>
/// <param name="e">SelectionChangedEventArgs</param>
private void ValidationSummary_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// ValidationSummary only supports single-selection mode.
if (e.AddedItems.Count == 1)
{
_selectedValidationSummaryItem = e.AddedItems[0] as ValidationSummaryItem;
}
this.UpdateValidationStatus();
}
#endif
// Recursively expands parent RowGroupHeaders from the top down
private void ExpandRowGroupParentChain(int level, int slot)
{
if (level < 0)
{
return;
}
int previousHeaderSlot = this.RowGroupHeadersTable.GetPreviousIndex(slot + 1);
while (previousHeaderSlot >= 0)
{
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(previousHeaderSlot);
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
if (level == rowGroupInfo.Level)
{
if (_collapsedSlotsTable.Contains(rowGroupInfo.Slot))
{
// Keep going up the chain
ExpandRowGroupParentChain(level - 1, rowGroupInfo.Slot - 1);
}
if (rowGroupInfo.Visibility != Visibility.Visible)
{
EnsureRowGroupVisibility(rowGroupInfo, Visibility.Visible, false);
}
return;
}
else
{
previousHeaderSlot = this.RowGroupHeadersTable.GetPreviousIndex(previousHeaderSlot);
}
}
}
#if FEATURE_VALIDATION_SUMMARY
/// <summary>
/// Searches through the DataGrid's ValidationSummary for any errors that use the given
/// ValidationResult as the ValidationSummaryItem's Context value.
/// </summary>
/// <param name="context">ValidationResult</param>
/// <returns>ValidationSummaryItem or null if not found</returns>
private ValidationSummaryItem FindValidationSummaryItem(ValidationResult context)
{
DiagnosticsDebug.Assert(context != null);
DiagnosticsDebug.Assert(_validationSummary != null);
foreach (ValidationSummaryItem ValidationSummaryItem in _validationSummary.Errors)
{
if (context.Equals(ValidationSummaryItem.Context))
{
return ValidationSummaryItem;
}
}
return null;
}
#endif
private void InvalidateCellsArrange()
{
foreach (DataGridRow row in GetAllRows())
{
row.InvalidateHorizontalArrange();
}
}
private void InvalidateColumnHeadersArrange()
{
if (_columnHeadersPresenter != null)
{
_columnHeadersPresenter.InvalidateArrange();
}
}
private void InvalidateColumnHeadersMeasure()
{
if (_columnHeadersPresenter != null)
{
EnsureColumnHeadersVisibility();
_columnHeadersPresenter.InvalidateMeasure();
}
}
private void InvalidateRowsArrange()
{
if (_rowsPresenter != null)
{
_rowsPresenter.InvalidateArrange();
}
}
private void InvalidateRowsMeasure(bool invalidateIndividualElements)
{
if (_rowsPresenter != null)
{
_rowsPresenter.InvalidateMeasure();
if (invalidateIndividualElements)
{
foreach (UIElement element in _rowsPresenter.Children)
{
element.InvalidateMeasure();
}
}
}
}
private void DataGrid_GettingFocus(UIElement sender, GettingFocusEventArgs e)
{
_focusInputDevice = e.InputDevice;
}
private void DataGrid_GotFocus(object sender, RoutedEventArgs e)
{
if (!this.ContainsFocus)
{
this.ContainsFocus = true;
ApplyDisplayedRowsState(this.DisplayData.FirstScrollingSlot, this.DisplayData.LastScrollingSlot);
if (this.CurrentColumnIndex != -1 && this.IsSlotVisible(this.CurrentSlot))
{
UpdateCurrentState(this.DisplayData.GetDisplayedElement(this.CurrentSlot), this.CurrentColumnIndex, true /*applyCellState*/);
}
}
DependencyObject focusedElement = e.OriginalSource as DependencyObject;
_focusedObject = focusedElement;
while (focusedElement != null)
{
// Keep track of which row contains the newly focused element
var focusedRow = focusedElement as DataGridRow;
if (focusedRow != null && focusedRow.OwningGrid == this && _focusedRow != focusedRow)
{
ResetFocusedRow();
_focusedRow = focusedRow.Visibility == Visibility.Visible ? focusedRow : null;
break;
}
focusedElement = VisualTreeHelper.GetParent(focusedElement);
}
_preferMouseIndicators = _focusInputDevice == FocusInputDeviceKind.Mouse || _focusInputDevice == FocusInputDeviceKind.Pen;
ShowScrollBars();
// If the DataGrid itself got focus, we actually want the automation focus to be on the current element
if (e.OriginalSource == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
{
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationFocusChangedEvent(this.CurrentSlot, this.CurrentColumnIndex);
}
}
}
private void DataGrid_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
UpdateDisabledVisual();
if (!this.IsEnabled)
{
HideScrollBars(true /*useTransitions*/);
}
}
private void DataGrid_KeyDown(object sender, KeyRoutedEventArgs e)
{
if (!e.Handled)
{
e.Handled = ProcessDataGridKey(e);
this.LastHandledKeyDown = e.Handled ? e.Key : VirtualKey.None;
}
}
private void DataGrid_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Tab && e.OriginalSource == this)
{
if (this.CurrentColumnIndex == -1)
{
if (this.ColumnHeaders != null && this.AreColumnHeadersVisible && !this.ColumnHeaderHasFocus)
{
this.ColumnHeaderHasFocus = true;
}
}
else
{
if (this.ColumnHeaders != null && this.AreColumnHeadersVisible)
{
KeyboardHelper.GetMetaKeyState(out _, out var shift);
if (shift && this.LastHandledKeyDown != VirtualKey.Tab)
{
DiagnosticsDebug.Assert(!this.ColumnHeaderHasFocus, "Expected ColumnHeaderHasFocus is false.");
// Show currency on the current column's header as focus is entering the DataGrid backwards.
this.ColumnHeaderHasFocus = true;
}
}
bool success = ScrollSlotIntoView(this.CurrentColumnIndex, this.CurrentSlot, false /*forCurrentCellChange*/, true /*forceHorizontalScroll*/);
DiagnosticsDebug.Assert(success, "Expected ScrollSlotIntoView returns true.");
if (this.CurrentColumnIndex != -1 && this.SelectedItem == null)
{
SetRowSelection(this.CurrentSlot, true /*isSelected*/, true /*setAnchorSlot*/);
}
}
}
}
private void DataGrid_LostFocus(object sender, RoutedEventArgs e)
{
_focusedObject = null;
if (this.ContainsFocus)
{
bool focusLeftDataGrid = true;
bool dataGridWillReceiveRoutedEvent = true;
DataGridColumn editingColumn = null;
// Walk up the visual tree of the newly focused element
// to determine if focus is still within DataGrid.
object focusedObject = GetFocusedElement();
DependencyObject focusedDependencyObject = focusedObject as DependencyObject;
while (focusedDependencyObject != null)
{
if (focusedDependencyObject == this)
{
focusLeftDataGrid = false;
break;
}
// Walk up the visual tree. Try using the framework element's
// parent. We do this because Popups behave differently with respect to the visual tree,
// and it could have a parent even if the VisualTreeHelper doesn't find it.
DependencyObject parent = null;
FrameworkElement element = focusedDependencyObject as FrameworkElement;
if (element == null)
{
parent = VisualTreeHelper.GetParent(focusedDependencyObject);
}
else
{
parent = element.Parent;
if (parent == null)
{
parent = VisualTreeHelper.GetParent(focusedDependencyObject);
}
else
{
dataGridWillReceiveRoutedEvent = false;
}
}
focusedDependencyObject = parent;
}
if (this.EditingRow != null && this.EditingColumnIndex != -1)
{
editingColumn = this.ColumnsItemsInternal[this.EditingColumnIndex];
if (focusLeftDataGrid && editingColumn is DataGridTemplateColumn)
{
dataGridWillReceiveRoutedEvent = false;
}
}
if (focusLeftDataGrid && !(editingColumn is DataGridTemplateColumn))
{
this.ContainsFocus = false;
if (this.EditingRow != null)
{
CommitEdit(DataGridEditingUnit.Row, true /*exitEditingMode*/);
}
ResetFocusedRow();
ApplyDisplayedRowsState(this.DisplayData.FirstScrollingSlot, this.DisplayData.LastScrollingSlot);
if (this.ColumnHeaderHasFocus)
{
this.ColumnHeaderHasFocus = false;
}
else if (this.CurrentColumnIndex != -1 && this.IsSlotVisible(this.CurrentSlot))
{
UpdateCurrentState(this.DisplayData.GetDisplayedElement(this.CurrentSlot), this.CurrentColumnIndex, true /*applyCellState*/);
}
}
else if (!dataGridWillReceiveRoutedEvent)
{
FrameworkElement focusedElement = focusedObject as FrameworkElement;
if (focusedElement != null)
{
focusedElement.LostFocus += new RoutedEventHandler(ExternalEditingElement_LostFocus);
}
}
}
}
private object GetFocusedElement()
{
if (TypeHelper.IsXamlRootAvailable && XamlRoot != null)
{
return FocusManager.GetFocusedElement(XamlRoot);
}
else
{
return FocusManager.GetFocusedElement();
}
}
private void DataGrid_PointerEntered(object sender, PointerRoutedEventArgs e)
{
if (e.Pointer.PointerDeviceType != PointerDeviceType.Touch)
{
// Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
_preferMouseIndicators = true;
ShowScrollBars();
}
}
private void DataGrid_PointerExited(object sender, PointerRoutedEventArgs e)
{
if (e.Pointer.PointerDeviceType != PointerDeviceType.Touch)
{
// Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
_isPointerOverHorizontalScrollBar = false;
_isPointerOverVerticalScrollBar = false;
_preferMouseIndicators = true;
ShowScrollBars();
HideScrollBarsAfterDelay();
}
}
private void DataGrid_PointerMoved(object sender, PointerRoutedEventArgs e)
{
// Don't process if this is a generated replay of the event.
if (e.IsGenerated)
{
return;
}
if (e.Pointer.PointerDeviceType != PointerDeviceType.Touch)
{
// Mouse/Pen inputs dominate. If touch panning indicators are shown, switch to mouse indicators.
_preferMouseIndicators = true;
ShowScrollBars();
if (!UISettingsHelper.AreSettingsEnablingAnimations &&
_hideScrollBarsTimer != null &&
(_isPointerOverHorizontalScrollBar || _isPointerOverVerticalScrollBar))
{
StopHideScrollBarsTimer();
}
}
}
private void DataGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
{
if (e.Handled)
{
return;
}
// Show the scroll bars as soon as a pointer is pressed on the DataGrid.
ShowScrollBars();
}
private void DataGrid_PointerReleased(object sender, PointerRoutedEventArgs e)
{
if (this.CurrentColumnIndex != -1 && this.CurrentSlot != -1)
{
e.Handled = true;
}
}
private void DataGrid_Unloaded(object sender, RoutedEventArgs e)
{
_showingMouseIndicators = false;
_keepScrollBarsShowing = false;
}
#if FEATURE_VALIDATION
private void EditingElement_BindingValidationError(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added && e.Error.Exception != null && e.Error.ErrorContent != null)
{
ValidationResult validationResult = new ValidationResult(e.Error.ErrorContent.ToString(), new List<string>() { _updateSourcePath });
_bindingValidationResults.AddIfNew(validationResult);
}
}
#endif
private void EditingElement_Loaded(object sender, RoutedEventArgs e)
{
FrameworkElement element = sender as FrameworkElement;
if (element != null)
{
element.Loaded -= new RoutedEventHandler(EditingElement_Loaded);
}
PreparingCellForEditPrivate(element);
}
private bool EndCellEdit(DataGridEditAction editAction, bool exitEditingMode, bool keepFocus, bool raiseEvents)
{
if (_editingColumnIndex == -1)
{
return true;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals this.CurrentColumnIndex.");
// Cache these to see if they change later
int currentSlot = this.CurrentSlot;
int currentColumnIndex = this.CurrentColumnIndex;
// We're ready to start ending, so raise the event
DataGridCell editingCell = this.EditingRow.Cells[_editingColumnIndex];
FrameworkElement editingElement = editingCell.Content as FrameworkElement;
if (editingElement == null)
{
return false;
}
if (raiseEvents)
{
DataGridCellEditEndingEventArgs e = new DataGridCellEditEndingEventArgs(this.CurrentColumn, this.EditingRow, editingElement, editAction);
OnCellEditEnding(e);
if (e.Cancel)
{
// CellEditEnding has been canceled
return false;
}
// Ensure that the current cell wasn't changed in the user's CellEditEnding handler
if (_editingColumnIndex == -1 ||
currentSlot != this.CurrentSlot ||
currentColumnIndex != this.CurrentColumnIndex)
{
return true;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
}
_bindingValidationResults.Clear();
// If we're canceling, let the editing column repopulate its old value if it wants
if (editAction == DataGridEditAction.Cancel)
{
this.CurrentColumn.CancelCellEditInternal(editingElement, _uneditedValue);
// Ensure that the current cell wasn't changed in the user column's CancelCellEdit
if (_editingColumnIndex == -1 ||
currentSlot != this.CurrentSlot ||
currentColumnIndex != this.CurrentColumnIndex)
{
return true;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == currentSlot, "Expected EditingRow.Slot equals currentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
// Re-validate
this.ValidateEditingRow(true /*scrollIntoView*/, false /*wireEvents*/);
}
// If we're committing, explicitly update the source but watch out for any validation errors
if (editAction == DataGridEditAction.Commit)
{
foreach (BindingInfo bindingData in this.CurrentColumn.GetInputBindings(editingElement, this.CurrentItem))
{
DiagnosticsDebug.Assert(bindingData.BindingExpression.ParentBinding != null, "Expected non-null bindingData.BindingExpression.ParentBinding.");
_updateSourcePath = bindingData.BindingExpression.ParentBinding.Path != null ? bindingData.BindingExpression.ParentBinding.Path.Path : null;
#if FEATURE_VALIDATION
bindingData.Element.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(EditingElement_BindingValidationError);
#endif
try
{
bindingData.BindingExpression.UpdateSource();
}
finally
{
#if FEATURE_VALIDATION
bindingData.Element.BindingValidationError -= new EventHandler<ValidationErrorEventArgs>(EditingElement_BindingValidationError);
#endif
}
}
// Re-validate
this.ValidateEditingRow(true /*scrollIntoView*/, false /*wireEvents*/);
if (_bindingValidationResults.Count > 0)
{
ScrollSlotIntoView(this.CurrentColumnIndex, this.CurrentSlot, false /*forCurrentCellChange*/, true /*forceHorizontalScroll*/);
return false;
}
}
if (exitEditingMode)
{
_editingColumnIndex = -1;
editingCell.ApplyCellState(true /*animate*/);
// TODO: Figure out if we should restore a cached this.IsTabStop.
this.IsTabStop = true;
if (keepFocus && editingElement.ContainsFocusedElement(this))
{
this.Focus(FocusState.Programmatic);
}
PopulateCellContent(!exitEditingMode /*isCellEdited*/, this.CurrentColumn, this.EditingRow, editingCell);
}
// We're done, so raise the CellEditEnded event
if (raiseEvents)
{
OnCellEditEnded(new DataGridCellEditEndedEventArgs(this.CurrentColumn, this.EditingRow, editAction));
}
// There's a chance that somebody reopened this cell for edit within the CellEditEnded handler,
// so we should return false if we were supposed to exit editing mode, but we didn't
return !(exitEditingMode && currentColumnIndex == _editingColumnIndex);
}
private bool EndRowEdit(DataGridEditAction editAction, bool exitEditingMode, bool raiseEvents)
{
// Explicit row end edit has been triggered, so we can no longer be initializing a new item.
_initializingNewItem = false;
if (this.EditingRow == null || this.DataConnection.EndingEdit)
{
return true;
}
if (_editingColumnIndex != -1 || (editAction == DataGridEditAction.Cancel && raiseEvents &&
!(this.DataConnection.CanCancelEdit || this.EditingRow.DataContext is IEditableObject || this.DataConnection.IsAddingNew)))
{
// Ending the row edit will fail immediately under the following conditions:
// 1. We haven't ended the cell edit yet.
// 2. We're trying to cancel edit when the underlying DataType is not an IEditableObject,
// because we have no way to properly restore the old value. We will only allow this to occur if:
// a. raiseEvents == false, which means we're internally forcing a cancel or
// b. we're canceling a new item addition.
return false;
}
DataGridRow editingRow = this.EditingRow;
if (raiseEvents)
{
DataGridRowEditEndingEventArgs e = new DataGridRowEditEndingEventArgs(this.EditingRow, editAction);
OnRowEditEnding(e);
if (e.Cancel)
{
// RowEditEnding has been canceled
return false;
}
// Editing states might have been changed in the RowEditEnding handlers
if (_editingColumnIndex != -1)
{
return false;
}
if (editingRow != this.EditingRow)
{
return true;
}
}
// Call the appropriate commit or cancel methods
if (editAction == DataGridEditAction.Commit)
{
if (!CommitRowEdit(exitEditingMode))
{
return false;
}
}
else
{
if (!CancelRowEdit(exitEditingMode) && raiseEvents)
{
// We failed to cancel edit so we should abort unless we're forcing a cancel
return false;
}
}
ResetValidationStatus();
// Update the previously edited row's state
if (exitEditingMode && editingRow == this.EditingRow)
{
// Unwire the INDEI event handlers
foreach (INotifyDataErrorInfo indei in _validationItems.Keys)
{
indei.ErrorsChanged -= new EventHandler<DataErrorsChangedEventArgs>(ValidationItem_ErrorsChanged);
}
_validationItems.Clear();
this.RemoveEditingElements();
ResetEditingRow();
}
if (this.CurrentSlot == -1 && this.DataConnection.CollectionView != null && this.DataConnection.CollectionView.CurrentItem != null)
{
// Some EditableCollectionViews (ListCollectionView in particular) do not raise CurrentChanged when CommitEdit
// changes the position of the CurrentItem. Instead, they raise a PropertyChanged event for PositionChanged.
// We recognize that case here and setup the CurrentItem again if one exists but it was removed and re-added
// during Commit. This is better than reacting to PositionChanged which would double the work in most cases
// and likely introduce regressions.
UpdateStateOnCurrentChanged(this.DataConnection.CollectionView.CurrentItem, this.DataConnection.CollectionView.CurrentPosition);
}
// Raise the RowEditEnded event
if (raiseEvents)
{
OnRowEditEnded(new DataGridRowEditEndedEventArgs(editingRow, editAction));
}
return true;
}
private void EnsureColumnHeadersVisibility()
{
if (_columnHeadersPresenter != null)
{
_columnHeadersPresenter.Visibility = this.AreColumnHeadersVisible ? Visibility.Visible : Visibility.Collapsed;
}
}
private void EnsureVerticalGridLines()
{
if (this.AreColumnHeadersVisible)
{
double totalColumnsWidth = 0;
foreach (DataGridColumn column in this.ColumnsInternal)
{
totalColumnsWidth += column.ActualWidth;
column.HeaderCell.SeparatorVisibility = (column != this.ColumnsInternal.LastVisibleColumn || totalColumnsWidth < this.CellsWidth) ?
Visibility.Visible : Visibility.Collapsed;
}
}
foreach (DataGridRow row in GetAllRows())
{
row.EnsureGridLines();
}
}
/// <summary>
/// Exits editing mode without trying to commit or revert the editing, and
/// without repopulating the edited row's cell.
/// </summary>
private void ExitEdit(bool keepFocus)
{
// We're exiting editing mode, so we can no longer be initializing a new item.
_initializingNewItem = false;
if (this.EditingRow == null || this.DataConnection.EndingEdit)
{
DiagnosticsDebug.Assert(_editingColumnIndex == -1, "Expected _editingColumnIndex equal to -1.");
return;
}
if (_editingColumnIndex != -1)
{
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
_editingColumnIndex = -1;
this.EditingRow.Cells[this.CurrentColumnIndex].ApplyCellState(false /*animate*/);
}
// TODO: Figure out if we should restore a cached this.IsTabStop.
this.IsTabStop = true;
if (this.IsSlotVisible(this.EditingRow.Slot))
{
this.EditingRow.ApplyState(true /*animate*/);
}
ResetEditingRow();
if (keepFocus)
{
bool success = Focus(FocusState.Programmatic);
DiagnosticsDebug.Assert(success, "Expected successful Focus call.");
}
}
private void ExternalEditingElement_LostFocus(object sender, RoutedEventArgs e)
{
FrameworkElement element = sender as FrameworkElement;
if (element != null)
{
element.LostFocus -= new RoutedEventHandler(ExternalEditingElement_LostFocus);
DataGrid_LostFocus(sender, e);
}
}
private void FlushCurrentCellChanged()
{
if (_makeFirstDisplayedCellCurrentCellPending)
{
return;
}
if (this.SelectionHasChanged)
{
// selection is changing, don't raise CurrentCellChanged until it's done
_flushCurrentCellChanged = true;
FlushSelectionChanged();
return;
}
// We don't want to expand all intermediate currency positions, so we only expand
// the last current item before we flush the event
if (_collapsedSlotsTable.Contains(this.CurrentSlot) && this.CurrentSlot != this.SlotFromRowIndex(this.DataConnection.NewItemPlaceholderIndex))
{
DataGridRowGroupInfo rowGroupInfo = this.RowGroupHeadersTable.GetValueAt(this.RowGroupHeadersTable.GetPreviousIndex(this.CurrentSlot));
DiagnosticsDebug.Assert(rowGroupInfo != null, "Expected non-null rowGroupInfo.");
if (rowGroupInfo != null)
{
this.ExpandRowGroupParentChain(rowGroupInfo.Level, rowGroupInfo.Slot);
}
}
if (this.CurrentColumn != _previousCurrentColumn || this.CurrentItem != _previousCurrentItem)
{
this.CoerceSelectedItem();
_previousCurrentColumn = this.CurrentColumn;
_previousCurrentItem = this.CurrentItem;
OnCurrentCellChanged(EventArgs.Empty);
}
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null && this.CurrentCellCoordinates != _previousAutomationFocusCoordinates)
{
_previousAutomationFocusCoordinates = new DataGridCellCoordinates(this.CurrentCellCoordinates);
// If the DataGrid itself has focus, we want to move automation focus to the new current element
object focusedObject = GetFocusedElement();
if (focusedObject == this && AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
{
peer.RaiseAutomationFocusChangedEvent(this.CurrentSlot, this.CurrentColumnIndex);
}
}
_flushCurrentCellChanged = false;
}
private void FlushSelectionChanged()
{
if (this.SelectionHasChanged && _noSelectionChangeCount == 0 && !_makeFirstDisplayedCellCurrentCellPending)
{
this.CoerceSelectedItem();
if (this.NoCurrentCellChangeCount != 0)
{
// current cell is changing, don't raise SelectionChanged until it's done
return;
}
this.SelectionHasChanged = false;
if (_flushCurrentCellChanged)
{
FlushCurrentCellChanged();
}
SelectionChangedEventArgs e = _selectedItems.GetSelectionChangedEventArgs();
if (e.AddedItems.Count > 0 || e.RemovedItems.Count > 0)
{
OnSelectionChanged(e);
}
}
}
private bool FocusEditingCell(bool setFocus)
{
DiagnosticsDebug.Assert(this.CurrentColumnIndex >= 0, "Expected positive CurrentColumnIndex.");
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.CurrentSlot >= -1, "Expected CurrentSlot greater than or equal to -1.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex != -1, "Expected _editingColumnIndex other than -1.");
// TODO: Figure out if we should cache this.IsTabStop in order to restore
// it later instead of setting it back to true unconditionally.
this.IsTabStop = false;
_focusEditingControl = false;
bool success = false;
DataGridCell dataGridCell = this.EditingRow.Cells[_editingColumnIndex];
if (setFocus)
{
if (dataGridCell.ContainsFocusedElement(this))
{
success = true;
}
else
{
success = dataGridCell.Focus(FocusState.Programmatic);
}
_focusEditingControl = !success;
}
return success;
}
/// <summary>
/// This method formats a row (specified by a DataGridRowClipboardEventArgs) into
/// a single string to be added to the Clipboard when the DataGrid is copying its contents.
/// </summary>
/// <param name="e">DataGridRowClipboardEventArgs</param>
/// <returns>The formatted string.</returns>
private string FormatClipboardContent(DataGridRowClipboardEventArgs e)
{
StringBuilder text = new StringBuilder();
for (int cellIndex = 0; cellIndex < e.ClipboardRowContent.Count; cellIndex++)
{
DataGridClipboardCellContent cellContent = e.ClipboardRowContent[cellIndex];
if (cellContent != null)
{
text.Append(cellContent.Content);
}
if (cellIndex < e.ClipboardRowContent.Count - 1)
{
text.Append('\t');
}
else
{
text.Append('\r');
text.Append('\n');
}
}
return text.ToString();
}
// Calculates the amount to scroll for the ScrollLeft button
// This is a method rather than a property to emphasize a calculation
private double GetHorizontalSmallScrollDecrease()
{
// If the first column is covered up, scroll to the start of it when the user clicks the left button
if (_negHorizontalOffset > 0)
{
return _negHorizontalOffset;
}
else
{
// The entire first column is displayed, show the entire previous column when the user clicks
// the left button
DataGridColumn previousColumn = this.ColumnsInternal.GetPreviousVisibleScrollingColumn(
this.ColumnsItemsInternal[DisplayData.FirstDisplayedScrollingCol]);
if (previousColumn != null)
{
return GetEdgedColumnWidth(previousColumn);
}
else
{
// There's no previous column so don't move
return 0;
}
}
}
// Calculates the amount to scroll for the ScrollRight button
// This is a method rather than a property to emphasize a calculation
private double GetHorizontalSmallScrollIncrease()
{
if (this.DisplayData.FirstDisplayedScrollingCol >= 0)
{
return GetEdgedColumnWidth(this.ColumnsItemsInternal[DisplayData.FirstDisplayedScrollingCol]) - _negHorizontalOffset;
}
return 0;
}
// Calculates the amount the ScrollDown button should scroll
// This is a method rather than a property to emphasize that calculations are taking place
private double GetVerticalSmallScrollIncrease()
{
if (this.DisplayData.FirstScrollingSlot >= 0)
{
return GetExactSlotElementHeight(this.DisplayData.FirstScrollingSlot) - this.NegVerticalOffset;
}
return 0;
}
private void HideScrollBars(bool useTransitions)
{
if (!_keepScrollBarsShowing)
{
_proposedScrollBarsState = ScrollBarVisualState.NoIndicator;
_proposedScrollBarsSeparatorState = UISettingsHelper.AreSettingsEnablingAnimations ? ScrollBarsSeparatorVisualState.SeparatorCollapsed : ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation;
if (UISettingsHelper.AreSettingsAutoHidingScrollBars)
{
SwitchScrollBarsVisualStates(_proposedScrollBarsState, _proposedScrollBarsSeparatorState, useTransitions);
}
}
}
private void HideScrollBarsAfterDelay()
{
if (!_keepScrollBarsShowing)
{
DispatcherQueueTimer hideScrollBarsTimer = null;
if (_hideScrollBarsTimer != null)
{
hideScrollBarsTimer = _hideScrollBarsTimer;
if (hideScrollBarsTimer.IsRunning)
{
hideScrollBarsTimer.Stop();
}
}
else
{
hideScrollBarsTimer = DispatcherQueue.GetForCurrentThread().CreateTimer();
hideScrollBarsTimer.Interval = TimeSpan.FromMilliseconds(DATAGRID_noScrollBarCountdownMs);
hideScrollBarsTimer.Tick += HideScrollBarsTimerTick;
_hideScrollBarsTimer = hideScrollBarsTimer;
}
hideScrollBarsTimer.Start();
}
}
private void HideScrollBarsTimerTick(object sender, object e)
{
StopHideScrollBarsTimer();
HideScrollBars(true /*useTransitions*/);
}
private void HookDataGridEvents()
{
this.IsEnabledChanged += new DependencyPropertyChangedEventHandler(DataGrid_IsEnabledChanged);
this.KeyDown += new KeyEventHandler(DataGrid_KeyDown);
this.KeyUp += new KeyEventHandler(DataGrid_KeyUp);
this.GettingFocus += new TypedEventHandler<UIElement, GettingFocusEventArgs>(DataGrid_GettingFocus);
this.GotFocus += new RoutedEventHandler(DataGrid_GotFocus);
this.LostFocus += new RoutedEventHandler(DataGrid_LostFocus);
this.PointerEntered += new PointerEventHandler(DataGrid_PointerEntered);
this.PointerExited += new PointerEventHandler(DataGrid_PointerExited);
this.PointerMoved += new PointerEventHandler(DataGrid_PointerMoved);
this.PointerPressed += new PointerEventHandler(DataGrid_PointerPressed);
this.PointerReleased += new PointerEventHandler(DataGrid_PointerReleased);
this.Unloaded += new RoutedEventHandler(DataGrid_Unloaded);
}
private void HookHorizontalScrollBarEvents()
{
if (_hScrollBar != null)
{
_hScrollBar.Scroll += new ScrollEventHandler(HorizontalScrollBar_Scroll);
_hScrollBar.PointerEntered += new PointerEventHandler(HorizontalScrollBar_PointerEntered);
_hScrollBar.PointerExited += new PointerEventHandler(HorizontalScrollBar_PointerExited);
}
}
private void HookVerticalScrollBarEvents()
{
if (_vScrollBar != null)
{
_vScrollBar.Scroll += new ScrollEventHandler(VerticalScrollBar_Scroll);
_vScrollBar.PointerEntered += new PointerEventHandler(VerticalScrollBar_PointerEntered);
_vScrollBar.PointerExited += new PointerEventHandler(VerticalScrollBar_PointerExited);
}
}
private void HorizontalScrollBar_PointerEntered(object sender, PointerRoutedEventArgs e)
{
_isPointerOverHorizontalScrollBar = true;
if (!UISettingsHelper.AreSettingsEnablingAnimations)
{
HideScrollBarsAfterDelay();
}
}
private void HorizontalScrollBar_PointerExited(object sender, PointerRoutedEventArgs e)
{
_isPointerOverHorizontalScrollBar = false;
HideScrollBarsAfterDelay();
}
private void VerticalScrollBar_PointerEntered(object sender, PointerRoutedEventArgs e)
{
_isPointerOverVerticalScrollBar = true;
if (!UISettingsHelper.AreSettingsEnablingAnimations)
{
HideScrollBarsAfterDelay();
}
}
private void VerticalScrollBar_PointerExited(object sender, PointerRoutedEventArgs e)
{
_isPointerOverVerticalScrollBar = false;
HideScrollBarsAfterDelay();
}
private void HorizontalScrollBar_Scroll(object sender, ScrollEventArgs e)
{
ProcessHorizontalScroll(e.ScrollEventType);
}
private void IndicatorStateStoryboard_Completed(object sender, object e)
{
// If the cursor is currently directly over either scroll bar then do not automatically hide the indicators.
if (!_keepScrollBarsShowing &&
!_isPointerOverVerticalScrollBar &&
!_isPointerOverHorizontalScrollBar)
{
// Go to the NoIndicator state using transitions.
if (UISettingsHelper.AreSettingsEnablingAnimations)
{
// By default there is a delay before the NoIndicator state actually shows.
HideScrollBars(true /*useTransitions*/);
}
else
{
// Since OS animations are turned off, use a timer to delay the scroll bars' hiding.
HideScrollBarsAfterDelay();
}
}
}
private bool IsColumnOutOfBounds(int columnIndex)
{
return columnIndex >= this.ColumnsItemsInternal.Count || columnIndex < 0;
}
private bool IsInnerCellOutOfBounds(int columnIndex, int slot)
{
return IsColumnOutOfBounds(columnIndex) || IsSlotOutOfBounds(slot);
}
private bool IsInnerCellOutOfSelectionBounds(int columnIndex, int slot)
{
return IsColumnOutOfBounds(columnIndex) || IsSlotOutOfSelectionBounds(slot);
}
private bool IsSlotOutOfBounds(int slot)
{
return slot >= this.SlotCount || slot < -1 || _collapsedSlotsTable.Contains(slot);
}
private bool IsSlotOutOfSelectionBounds(int slot)
{
if (this.RowGroupHeadersTable.Contains(slot))
{
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
return false;
}
else
{
int rowIndex = RowIndexFromSlot(slot);
return rowIndex < 0 || rowIndex >= this.DataConnection.Count;
}
}
private void LoadMoreDataFromIncrementalItemsSource(double totalVisibleHeight)
{
if (IncrementalLoadingTrigger == IncrementalLoadingTrigger.Edge && DataConnection.IsDataSourceIncremental && DataConnection.HasMoreItems && !DataConnection.IsLoadingMoreItems)
{
var bottomScrolledOffHeight = Math.Max(0, totalVisibleHeight - CellsHeight - VerticalOffset);
if ((IncrementalLoadingThreshold * CellsHeight) >= bottomScrolledOffHeight)
{
var numberOfRowsToLoad = Math.Max(1, (int)(DataFetchSize * CellsHeight / RowHeightEstimate));
DataConnection.LoadMoreItems((uint)numberOfRowsToLoad);
}
}
}
private void MakeFirstDisplayedCellCurrentCell()
{
if (this.CurrentColumnIndex != -1)
{
_makeFirstDisplayedCellCurrentCellPending = false;
_desiredCurrentColumnIndex = -1;
this.FlushCurrentCellChanged();
return;
}
if (this.SlotCount != SlotFromRowIndex(this.DataConnection.Count))
{
_makeFirstDisplayedCellCurrentCellPending = true;
return;
}
// No current cell, therefore no selection either - try to set the current cell to the
// ItemsSource's ICollectionView.CurrentItem if it exists, otherwise use the first displayed cell.
int slot;
if (this.DataConnection.CollectionView != null)
{
if (this.DataConnection.CollectionView.IsCurrentBeforeFirst ||
this.DataConnection.CollectionView.IsCurrentAfterLast)
{
slot = this.RowGroupHeadersTable.Contains(0) ? 0 : -1;
}
else
{
slot = SlotFromRowIndex(this.DataConnection.CollectionView.CurrentPosition);
}
}
else
{
if (this.SelectedIndex == -1)
{
// Try to default to the first row
slot = SlotFromRowIndex(0);
if (!this.IsSlotVisible(slot))
{
slot = -1;
}
}
else
{
slot = SlotFromRowIndex(this.SelectedIndex);
}
}
int columnIndex = this.FirstDisplayedNonFillerColumnIndex;
if (_desiredCurrentColumnIndex >= 0 && _desiredCurrentColumnIndex < this.ColumnsItemsInternal.Count)
{
columnIndex = _desiredCurrentColumnIndex;
}
SetAndSelectCurrentCell(
columnIndex,
slot,
false /*forceCurrentCellSelection*/);
this.AnchorSlot = slot;
_makeFirstDisplayedCellCurrentCellPending = false;
_desiredCurrentColumnIndex = -1;
FlushCurrentCellChanged();
}
private void NoIndicatorStateStoryboard_Completed(object sender, object e)
{
DiagnosticsDebug.Assert(_hasNoIndicatorStateStoryboardCompletedHandler, "Expected _hasNoIndicatorStateStoryboardCompletedHandler is true.");
_showingMouseIndicators = false;
}
private void PopulateCellContent(
bool isCellEdited,
DataGridColumn dataGridColumn,
DataGridRow dataGridRow,
DataGridCell dataGridCell)
{
DiagnosticsDebug.Assert(dataGridColumn != null, "Expected non-null dataGridColumn.");
DiagnosticsDebug.Assert(dataGridRow != null, "Expected non-null dataGridRow.");
DiagnosticsDebug.Assert(dataGridCell != null, "Expected non-null dataGridCell.");
FrameworkElement element = null;
DataGridBoundColumn dataGridBoundColumn = dataGridColumn as DataGridBoundColumn;
if (isCellEdited)
{
// Generate EditingElement and apply column style if available
element = dataGridColumn.GenerateEditingElementInternal(dataGridCell, dataGridRow.DataContext);
if (element != null)
{
if (dataGridBoundColumn != null && dataGridBoundColumn.EditingElementStyle != null)
{
element.SetStyleWithType(dataGridBoundColumn.EditingElementStyle);
}
// Subscribe to the new element's events
element.Loaded += new RoutedEventHandler(EditingElement_Loaded);
}
}
else
{
// Generate Element and apply column style if available
element = dataGridColumn.GenerateElementInternal(dataGridCell, dataGridRow.DataContext);
if (element != null)
{
if (dataGridBoundColumn != null && dataGridBoundColumn.ElementStyle != null)
{
element.SetStyleWithType(dataGridBoundColumn.ElementStyle);
}
}
#if FEATURE_VALIDATION
// If we are replacing the editingElement on the cell with the displayElement, and there
// were validation errors present on the editingElement, we need to manually force the
// control to go to the InvalidUnfocused state to support Implicit Styles. The reason
// is because the editingElement is being removed as part of a keystroke, and it will
// leave the visual tree before its state is updated. Since Implicit Styles are
// disabled when an element is removed from the visual tree, the subsequent GoToState fails
// and the editingElement cannot make it to the InvalidUnfocused state. As a result,
// any popups in the InvalidFocused state would stay around incorrectly.
if (this.EditingRow != null && dataGridCell.Content != null)
{
Control control = dataGridCell.Content as Control;
if (control != null && Validation.GetHasError(control))
{
VisualStateManager.GoToState(control, VisualStates.StateInvalidUnfocused, useTransitions: false);
}
}
#endif
}
dataGridCell.Content = element;
}
private void PreparingCellForEditPrivate(FrameworkElement editingElement)
{
if (_editingColumnIndex == -1 ||
this.CurrentColumnIndex == -1 ||
this.EditingRow.Cells[this.CurrentColumnIndex].Content != editingElement)
{
// The current cell has changed since the call to BeginCellEdit, so the fact
// that this element has loaded is no longer relevant
return;
}
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
DiagnosticsDebug.Assert(this.EditingRow.Slot == this.CurrentSlot, "Expected EditingRow.Slot equals CurrentSlot.");
DiagnosticsDebug.Assert(_editingColumnIndex >= 0, "Expected positive _editingColumnIndex.");
DiagnosticsDebug.Assert(_editingColumnIndex < this.ColumnsItemsInternal.Count, "Expected _editingColumnIndex smaller than this.ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(_editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals CurrentColumnIndex.");
FocusEditingCell(this.ContainsFocus || _focusEditingControl /*setFocus*/);
// Prepare the cell for editing and raise the PreparingCellForEdit event for all columns
DataGridColumn dataGridColumn = this.CurrentColumn;
_uneditedValue = dataGridColumn.PrepareCellForEditInternal(editingElement, _editingEventArgs);
OnPreparingCellForEdit(new DataGridPreparingCellForEditEventArgs(dataGridColumn, this.EditingRow, _editingEventArgs, editingElement));
}
private bool ProcessAKey()
{
bool ctrl, shift, alt;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift, out alt);
if (ctrl && !shift && !alt && this.SelectionMode == DataGridSelectionMode.Extended)
{
SelectAll();
return true;
}
return false;
}
/// <summary>
/// Handles the case where a 'Copy' key ('C' or 'Insert') has been pressed. If pressed in combination with
/// the control key, and the necessary prerequisites are met, the DataGrid will copy its contents
/// to the Clipboard as text.
/// </summary>
/// <returns>Whether or not the DataGrid handled the key press.</returns>
private bool ProcessCopyKey()
{
bool ctrl, shift, alt;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift, out alt);
if (ctrl &&
!shift &&
!alt &&
this.ClipboardCopyMode != DataGridClipboardCopyMode.None &&
this.SelectedItems.Count > 0 &&
_editingColumnIndex != this.CurrentColumnIndex)
{
StringBuilder textBuilder = new StringBuilder();
if (this.ClipboardCopyMode == DataGridClipboardCopyMode.IncludeHeader)
{
DataGridRowClipboardEventArgs headerArgs = new DataGridRowClipboardEventArgs(null, true);
foreach (DataGridColumn column in this.ColumnsInternal.GetVisibleColumns())
{
headerArgs.ClipboardRowContent.Add(new DataGridClipboardCellContent(null, column, column.Header));
}
this.OnCopyingRowClipboardContent(headerArgs);
textBuilder.Append(FormatClipboardContent(headerArgs));
}
for (int index = 0; index < this.SelectedItems.Count; index++)
{
object item = this.SelectedItems[index];
DataGridRowClipboardEventArgs itemArgs = new DataGridRowClipboardEventArgs(item, false);
foreach (DataGridColumn column in this.ColumnsInternal.GetVisibleColumns())
{
object content = column.GetCellValue(item, column.ClipboardContentBinding);
itemArgs.ClipboardRowContent.Add(new DataGridClipboardCellContent(item, column, content));
}
this.OnCopyingRowClipboardContent(itemArgs);
textBuilder.Append(FormatClipboardContent(itemArgs));
}
string text = textBuilder.ToString();
if (!string.IsNullOrEmpty(text))
{
try
{
DataPackage content = new DataPackage();
content.SetText(text);
Clipboard.SetContent(content);
}
catch (SecurityException)
{
// We will get a SecurityException if the user does not allow access to the clipboard.
}
return true;
}
}
return false;
}
private bool ProcessDataGridKey(KeyRoutedEventArgs e)
{
bool focusDataGrid = false;
switch (e.Key)
{
case VirtualKey.Tab:
return ProcessTabKey(e);
case VirtualKey.Up:
focusDataGrid = ProcessUpKey();
break;
case VirtualKey.Down:
focusDataGrid = ProcessDownKey();
break;
case VirtualKey.PageDown:
focusDataGrid = ProcessNextKey();
break;
case VirtualKey.PageUp:
focusDataGrid = ProcessPriorKey();
break;
case VirtualKey.Left:
focusDataGrid = this.FlowDirection == FlowDirection.LeftToRight ? ProcessLeftKey() : ProcessRightKey();
break;
case VirtualKey.Right:
focusDataGrid = this.FlowDirection == FlowDirection.LeftToRight ? ProcessRightKey() : ProcessLeftKey();
break;
case VirtualKey.F2:
return ProcessF2Key(e);
case VirtualKey.Home:
focusDataGrid = ProcessHomeKey();
break;
case VirtualKey.End:
focusDataGrid = ProcessEndKey();
break;
case VirtualKey.Enter:
focusDataGrid = ProcessEnterKey();
break;
case VirtualKey.Escape:
return ProcessEscapeKey();
case VirtualKey.A:
return ProcessAKey();
case VirtualKey.C:
return ProcessCopyKey();
case VirtualKey.Insert:
return ProcessCopyKey();
case VirtualKey.Space:
return ProcessSpaceKey();
}
if (focusDataGrid && this.IsTabStop)
{
this.Focus(FocusState.Programmatic);
}
return focusDataGrid;
}
private bool ProcessDownKeyInternal(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int lastSlot = this.LastVisibleSlot;
if (firstVisibleColumnIndex == -1 || lastSlot == -1)
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessDownKeyInternal(shift, ctrl); }))
{
return true;
}
int nextSlot = -1;
if (this.CurrentSlot != -1)
{
nextSlot = this.GetNextVisibleSlot(this.CurrentSlot);
if (nextSlot >= this.SlotCount)
{
nextSlot = -1;
}
}
_noSelectionChangeCount++;
try
{
int desiredSlot;
int columnIndex;
DataGridSelectionAction action;
if (this.ColumnHeaderHasFocus)
{
if (ctrl || shift)
{
return false;
}
if (this.CurrentSlot == this.FirstVisibleSlot)
{
this.ColumnHeaderHasFocus = false;
return true;
}
DiagnosticsDebug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
desiredSlot = this.FirstVisibleSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
else if (this.CurrentColumnIndex == -1)
{
desiredSlot = this.FirstVisibleSlot;
columnIndex = firstVisibleColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
else if (ctrl)
{
if (shift)
{
// Both Ctrl and Shift
desiredSlot = lastSlot;
columnIndex = this.CurrentColumnIndex;
action = (this.SelectionMode == DataGridSelectionMode.Extended)
? DataGridSelectionAction.SelectFromAnchorToCurrent
: DataGridSelectionAction.SelectCurrent;
}
else
{
// Ctrl without Shift
desiredSlot = lastSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
}
else
{
if (nextSlot == -1)
{
return true;
}
if (shift)
{
// Shift without Ctrl
desiredSlot = nextSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectFromAnchorToCurrent;
}
else
{
// Neither Ctrl nor Shift
desiredSlot = nextSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
}
UpdateSelectionAndCurrency(columnIndex, desiredSlot, action, true /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private bool ProcessEndKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.LastVisibleColumn;
int lastVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int firstVisibleSlot = this.FirstVisibleSlot;
int lastVisibleSlot = this.LastVisibleSlot;
if (lastVisibleColumnIndex == -1 || (firstVisibleSlot == -1 && !this.ColumnHeaderHasFocus))
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessEndKey(shift, ctrl); }))
{
return true;
}
_noSelectionChangeCount++;
try
{
if (!ctrl)
{
return ProcessRightMost(lastVisibleColumnIndex, firstVisibleSlot);
}
else if (firstVisibleSlot != -1)
{
DataGridSelectionAction action = (shift && this.SelectionMode == DataGridSelectionMode.Extended)
? DataGridSelectionAction.SelectFromAnchorToCurrent
: DataGridSelectionAction.SelectCurrent;
UpdateSelectionAndCurrency(lastVisibleColumnIndex, lastVisibleSlot, action, true /*scrollIntoView*/);
}
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private bool ProcessEnterKey(bool shift, bool ctrl)
{
int oldCurrentSlot = this.CurrentSlot;
if (!ctrl)
{
if (this.ColumnHeaderHasFocus)
{
this.CurrentColumn.HeaderCell.InvokeProcessSort();
return true;
}
else if (this.FirstVisibleSlot != -1 && this.RowGroupHeadersTable.Contains(this.CurrentSlot) && ToggleRowGroup())
{
return true;
}
// If Enter was used by a TextBox, we shouldn't handle the key
TextBox focusedTextBox = GetFocusedElement() as TextBox;
if (focusedTextBox != null && focusedTextBox.AcceptsReturn)
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessEnterKey(shift, ctrl); }))
{
return true;
}
// Enter behaves like down arrow - it commits the potential editing and goes down one cell.
if (!ProcessDownKeyInternal(false, ctrl))
{
return false;
}
}
else if (this.WaitForLostFocus(() => { this.ProcessEnterKey(shift, ctrl); }))
{
return true;
}
// Try to commit the potential editing
if (oldCurrentSlot == this.CurrentSlot && EndCellEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, true /*keepFocus*/, true /*raiseEvents*/) && this.EditingRow != null)
{
EndRowEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, true /*raiseEvents*/);
ScrollIntoView(this.CurrentItem, this.CurrentColumn);
}
return true;
}
private bool ProcessEscapeKey()
{
if (this.WaitForLostFocus(() => { this.ProcessEscapeKey(); }))
{
return true;
}
if (_editingColumnIndex != -1)
{
// Revert the potential cell editing and exit cell editing.
EndCellEdit(DataGridEditAction.Cancel, true /*exitEditingMode*/, true /*keepFocus*/, true /*raiseEvents*/);
return true;
}
else if (this.EditingRow != null)
{
// Revert the potential row editing and exit row editing.
EndRowEdit(DataGridEditAction.Cancel, true /*exitEditingMode*/, true /*raiseEvents*/);
return true;
}
return false;
}
private bool ProcessF2Key(KeyRoutedEventArgs e)
{
bool ctrl, shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
if (!shift && !ctrl &&
_editingColumnIndex == -1 && this.CurrentColumnIndex != -1 && GetRowSelection(this.CurrentSlot) &&
!GetColumnEffectiveReadOnlyState(this.CurrentColumn))
{
if (ScrollSlotIntoView(this.CurrentColumnIndex, this.CurrentSlot, false /*forCurrentCellChange*/, true /*forceHorizontalScroll*/))
{
BeginCellEdit(e);
}
return true;
}
return false;
}
private bool ProcessHomeKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int firstVisibleSlot = this.FirstVisibleSlot;
if (firstVisibleColumnIndex == -1 || (firstVisibleSlot == -1 && !this.ColumnHeaderHasFocus))
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessHomeKey(shift, ctrl); }))
{
return true;
}
_noSelectionChangeCount++;
try
{
if (!ctrl)
{
return ProcessLeftMost(firstVisibleColumnIndex, firstVisibleSlot);
}
else if (firstVisibleSlot != -1)
{
DataGridSelectionAction action = (shift && this.SelectionMode == DataGridSelectionMode.Extended)
? DataGridSelectionAction.SelectFromAnchorToCurrent
: DataGridSelectionAction.SelectCurrent;
UpdateSelectionAndCurrency(firstVisibleColumnIndex, firstVisibleSlot, action, true /*scrollIntoView*/);
}
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private bool ProcessLeftKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int firstVisibleSlot = this.FirstVisibleSlot;
if (firstVisibleColumnIndex == -1 || (firstVisibleSlot == -1 && !this.ColumnHeaderHasFocus))
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessLeftKey(shift, ctrl); }))
{
return true;
}
int previousVisibleColumnIndex = -1;
if (this.CurrentColumnIndex != -1)
{
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleNonFillerColumn(this.ColumnsItemsInternal[this.CurrentColumnIndex]);
if (dataGridColumn != null)
{
previousVisibleColumnIndex = dataGridColumn.Index;
}
}
DataGridColumn oldFocusedColumn = this.FocusedColumn;
_noSelectionChangeCount++;
try
{
if (ctrl)
{
return ProcessLeftMost(firstVisibleColumnIndex, firstVisibleSlot);
}
else if (firstVisibleSlot != -1 && (!this.RowGroupHeadersTable.Contains(this.CurrentSlot) || this.ColumnHeaderHasFocus))
{
if (this.CurrentColumnIndex == -1)
{
UpdateSelectionAndCurrency(firstVisibleColumnIndex, firstVisibleSlot, DataGridSelectionAction.SelectCurrent, true /*scrollIntoView*/);
}
else
{
if (previousVisibleColumnIndex == -1)
{
return true;
}
_noFocusedColumnChangeCount++;
try
{
UpdateSelectionAndCurrency(previousVisibleColumnIndex, this.CurrentSlot, DataGridSelectionAction.None, true /*scrollIntoView*/);
}
finally
{
_noFocusedColumnChangeCount--;
}
}
}
}
finally
{
this.NoSelectionChangeCount--;
}
if (this.ColumnHeaderHasFocus)
{
if (this.CurrentColumn == null)
{
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleNonFillerColumn(this.FocusedColumn);
if (dataGridColumn != null)
{
this.FocusedColumn = dataGridColumn;
}
}
else
{
this.FocusedColumn = this.CurrentColumn;
}
if (firstVisibleSlot == -1 && this.FocusedColumn != null)
{
ScrollColumnIntoView(this.FocusedColumn.Index);
}
}
bool focusedColumnChanged = this.ColumnHeaderHasFocus && oldFocusedColumn != this.FocusedColumn;
if (focusedColumnChanged)
{
if (oldFocusedColumn != null && oldFocusedColumn.HasHeaderCell)
{
oldFocusedColumn.HeaderCell.ApplyState(true);
}
if (this.FocusedColumn != null && this.FocusedColumn.HasHeaderCell)
{
this.FocusedColumn.HeaderCell.ApplyState(true);
}
}
return focusedColumnChanged || _successfullyUpdatedSelection;
}
// Ctrl Left <==> Home
private bool ProcessLeftMost(int firstVisibleColumnIndex, int firstVisibleSlot)
{
DataGridColumn oldFocusedColumn = this.FocusedColumn;
_noSelectionChangeCount++;
try
{
int desiredSlot;
DataGridSelectionAction action;
if (this.CurrentColumnIndex == -1)
{
desiredSlot = firstVisibleSlot;
action = DataGridSelectionAction.SelectCurrent;
DiagnosticsDebug.Assert(_selectedItems.Count == 0, "Expected _selectedItems.Count equals 0.");
}
else
{
desiredSlot = this.CurrentSlot;
action = DataGridSelectionAction.None;
}
_noFocusedColumnChangeCount++;
try
{
UpdateSelectionAndCurrency(firstVisibleColumnIndex, desiredSlot, action, true /*scrollIntoView*/);
}
finally
{
_noFocusedColumnChangeCount--;
}
}
finally
{
this.NoSelectionChangeCount--;
}
if (this.ColumnHeaderHasFocus)
{
if (this.CurrentColumn == null)
{
this.FocusedColumn = this.ColumnsInternal.FirstVisibleColumn;
}
else
{
this.FocusedColumn = this.CurrentColumn;
}
if (firstVisibleSlot == -1 && this.FocusedColumn != null)
{
ScrollColumnIntoView(this.FocusedColumn.Index);
}
}
bool focusedColumnChanged = this.ColumnHeaderHasFocus && oldFocusedColumn != this.FocusedColumn;
if (focusedColumnChanged)
{
if (oldFocusedColumn != null && oldFocusedColumn.HasHeaderCell)
{
oldFocusedColumn.HeaderCell.ApplyState(true);
}
if (this.FocusedColumn != null && this.FocusedColumn.HasHeaderCell)
{
this.FocusedColumn.HeaderCell.ApplyState(true);
}
}
return focusedColumnChanged || _successfullyUpdatedSelection;
}
private bool ProcessNextKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
if (firstVisibleColumnIndex == -1 || this.DisplayData.FirstScrollingSlot == -1)
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessNextKey(shift, ctrl); }))
{
return true;
}
int nextPageSlot = this.CurrentSlot == -1 ? this.DisplayData.FirstScrollingSlot : this.CurrentSlot;
DiagnosticsDebug.Assert(nextPageSlot != -1, "Expected nextPageSlot other than -1.");
int slot = GetNextVisibleSlot(nextPageSlot);
int scrollCount = this.DisplayData.NumTotallyDisplayedScrollingElements;
while (scrollCount > 0 && slot < this.SlotCount)
{
nextPageSlot = slot;
scrollCount--;
slot = GetNextVisibleSlot(slot);
}
_noSelectionChangeCount++;
try
{
DataGridSelectionAction action;
int columnIndex;
if (this.CurrentColumnIndex == -1)
{
columnIndex = firstVisibleColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
else
{
columnIndex = this.CurrentColumnIndex;
action = (shift && this.SelectionMode == DataGridSelectionMode.Extended)
? action = DataGridSelectionAction.SelectFromAnchorToCurrent
: action = DataGridSelectionAction.SelectCurrent;
}
UpdateSelectionAndCurrency(columnIndex, nextPageSlot, action, true /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private bool ProcessPriorKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
if (firstVisibleColumnIndex == -1 || this.DisplayData.FirstScrollingSlot == -1)
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessPriorKey(shift, ctrl); }))
{
return true;
}
int previousPageSlot = (this.CurrentSlot == -1) ? this.DisplayData.FirstScrollingSlot : this.CurrentSlot;
DiagnosticsDebug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
int scrollCount = this.DisplayData.NumTotallyDisplayedScrollingElements;
int slot = GetPreviousVisibleSlot(previousPageSlot);
while (scrollCount > 0 && slot != -1)
{
previousPageSlot = slot;
scrollCount--;
slot = GetPreviousVisibleSlot(slot);
}
DiagnosticsDebug.Assert(previousPageSlot != -1, "Expected previousPageSlot other than -1.");
_noSelectionChangeCount++;
try
{
int columnIndex;
DataGridSelectionAction action;
if (this.CurrentColumnIndex == -1)
{
columnIndex = firstVisibleColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
else
{
columnIndex = this.CurrentColumnIndex;
action = (shift && this.SelectionMode == DataGridSelectionMode.Extended)
? DataGridSelectionAction.SelectFromAnchorToCurrent
: DataGridSelectionAction.SelectCurrent;
}
UpdateSelectionAndCurrency(columnIndex, previousPageSlot, action, true /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private bool ProcessRightKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.LastVisibleColumn;
int lastVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int firstVisibleSlot = this.FirstVisibleSlot;
if (lastVisibleColumnIndex == -1 || (firstVisibleSlot == -1 && !this.ColumnHeaderHasFocus))
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessRightKey(shift, ctrl); }))
{
return true;
}
int nextVisibleColumnIndex = -1;
if (this.CurrentColumnIndex != -1)
{
dataGridColumn = this.ColumnsInternal.GetNextVisibleColumn(this.ColumnsItemsInternal[this.CurrentColumnIndex]);
if (dataGridColumn != null)
{
nextVisibleColumnIndex = dataGridColumn.Index;
}
}
DataGridColumn oldFocusedColumn = this.FocusedColumn;
_noSelectionChangeCount++;
try
{
if (ctrl)
{
return ProcessRightMost(lastVisibleColumnIndex, firstVisibleSlot);
}
else if (firstVisibleSlot != -1 && (!this.RowGroupHeadersTable.Contains(this.CurrentSlot) || this.ColumnHeaderHasFocus))
{
if (this.CurrentColumnIndex == -1)
{
int firstVisibleColumnIndex = this.ColumnsInternal.FirstVisibleColumn == null ? -1 : this.ColumnsInternal.FirstVisibleColumn.Index;
UpdateSelectionAndCurrency(firstVisibleColumnIndex, firstVisibleSlot, DataGridSelectionAction.SelectCurrent, true /*scrollIntoView*/);
}
else
{
if (nextVisibleColumnIndex == -1)
{
return true;
}
_noFocusedColumnChangeCount++;
try
{
UpdateSelectionAndCurrency(nextVisibleColumnIndex, this.CurrentSlot, DataGridSelectionAction.None, true /*scrollIntoView*/);
}
finally
{
_noFocusedColumnChangeCount--;
}
}
}
}
finally
{
this.NoSelectionChangeCount--;
}
if (this.ColumnHeaderHasFocus)
{
if (this.CurrentColumn == null)
{
dataGridColumn = this.ColumnsInternal.GetNextVisibleColumn(this.FocusedColumn);
if (dataGridColumn != null)
{
this.FocusedColumn = dataGridColumn;
}
}
else
{
this.FocusedColumn = this.CurrentColumn;
}
if (firstVisibleSlot == -1 && this.FocusedColumn != null)
{
ScrollColumnIntoView(this.FocusedColumn.Index);
}
}
bool focusedColumnChanged = this.ColumnHeaderHasFocus && oldFocusedColumn != this.FocusedColumn;
if (focusedColumnChanged)
{
if (oldFocusedColumn != null && oldFocusedColumn.HasHeaderCell)
{
oldFocusedColumn.HeaderCell.ApplyState(true);
}
if (this.FocusedColumn != null && this.FocusedColumn.HasHeaderCell)
{
this.FocusedColumn.HeaderCell.ApplyState(true);
}
}
return focusedColumnChanged || _successfullyUpdatedSelection;
}
// Ctrl Right <==> End
private bool ProcessRightMost(int lastVisibleColumnIndex, int firstVisibleSlot)
{
DataGridColumn oldFocusedColumn = this.FocusedColumn;
_noSelectionChangeCount++;
try
{
int desiredSlot;
DataGridSelectionAction action;
if (this.CurrentColumnIndex == -1)
{
desiredSlot = firstVisibleSlot;
action = DataGridSelectionAction.SelectCurrent;
}
else
{
desiredSlot = this.CurrentSlot;
action = DataGridSelectionAction.None;
}
_noFocusedColumnChangeCount++;
try
{
UpdateSelectionAndCurrency(lastVisibleColumnIndex, desiredSlot, action, true /*scrollIntoView*/);
}
finally
{
_noFocusedColumnChangeCount--;
}
}
finally
{
this.NoSelectionChangeCount--;
}
if (this.ColumnHeaderHasFocus)
{
if (this.CurrentColumn == null)
{
this.FocusedColumn = this.ColumnsInternal.LastVisibleColumn;
}
else
{
this.FocusedColumn = this.CurrentColumn;
}
if (firstVisibleSlot == -1 && this.FocusedColumn != null)
{
ScrollColumnIntoView(this.FocusedColumn.Index);
}
}
bool focusedColumnChanged = this.ColumnHeaderHasFocus && oldFocusedColumn != this.FocusedColumn;
if (focusedColumnChanged)
{
if (oldFocusedColumn != null && oldFocusedColumn.HasHeaderCell)
{
oldFocusedColumn.HeaderCell.ApplyState(true);
}
if (this.FocusedColumn != null && this.FocusedColumn.HasHeaderCell)
{
this.FocusedColumn.HeaderCell.ApplyState(true);
}
}
return focusedColumnChanged || _successfullyUpdatedSelection;
}
private bool ProcessSpaceKey()
{
return ToggleRowGroup();
}
private bool ProcessTabKey(KeyRoutedEventArgs e)
{
bool ctrl, shift;
KeyboardHelper.GetMetaKeyState(out ctrl, out shift);
return this.ProcessTabKey(e, shift, ctrl);
}
private bool ProcessTabKey(KeyRoutedEventArgs e, bool shift, bool ctrl)
{
if (ctrl || _editingColumnIndex == -1 || this.IsReadOnly)
{
// Go to the next/previous control on the page or the column header when
// - Ctrl key is used
// - Potential current cell is not edited, or the datagrid is read-only.
if (!shift && this.ColumnHeaders != null && this.AreColumnHeadersVisible && !this.ColumnHeaderHasFocus)
{
// Show focus on the current column's header.
this.ColumnHeaderHasFocus = true;
return true;
}
else if (shift && this.ColumnHeaderHasFocus)
{
this.ColumnHeaderHasFocus = false;
return this.CurrentColumnIndex != -1;
}
this.ColumnHeaderHasFocus = false;
return false;
}
// Try to locate a writable cell before/after the current cell
DiagnosticsDebug.Assert(this.CurrentColumnIndex != -1, "Expected CurrentColumnIndex other than -1.");
DiagnosticsDebug.Assert(this.CurrentSlot != -1, "Expected CurrentSlot other than -1.");
int neighborVisibleWritableColumnIndex, neighborSlot;
DataGridColumn dataGridColumn;
if (shift)
{
dataGridColumn = this.ColumnsInternal.GetPreviousVisibleWritableColumn(this.ColumnsItemsInternal[this.CurrentColumnIndex]);
neighborSlot = GetPreviousVisibleSlot(this.CurrentSlot);
if (this.EditingRow != null)
{
while (neighborSlot != -1 && this.RowGroupHeadersTable.Contains(neighborSlot))
{
neighborSlot = GetPreviousVisibleSlot(neighborSlot);
}
}
}
else
{
dataGridColumn = this.ColumnsInternal.GetNextVisibleWritableColumn(this.ColumnsItemsInternal[this.CurrentColumnIndex]);
neighborSlot = GetNextVisibleSlot(this.CurrentSlot);
if (this.EditingRow != null)
{
while (neighborSlot < this.SlotCount && this.RowGroupHeadersTable.Contains(neighborSlot))
{
neighborSlot = GetNextVisibleSlot(neighborSlot);
}
}
}
neighborVisibleWritableColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
if (neighborVisibleWritableColumnIndex == -1 && (neighborSlot == -1 || neighborSlot >= this.SlotCount))
{
// There is no previous/next row and no previous/next writable cell on the current row
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessTabKey(e, shift, ctrl); }))
{
return true;
}
int targetSlot = -1, targetColumnIndex = -1;
_noSelectionChangeCount++;
try
{
if (neighborVisibleWritableColumnIndex == -1)
{
targetSlot = neighborSlot;
if (shift)
{
DiagnosticsDebug.Assert(this.ColumnsInternal.LastVisibleWritableColumn != null, "Expected non-null ColumnsInternal.LastVisibleWritableColumn.");
targetColumnIndex = this.ColumnsInternal.LastVisibleWritableColumn.Index;
}
else
{
DiagnosticsDebug.Assert(this.ColumnsInternal.FirstVisibleWritableColumn != null, "Expected non-null ColumnsInternal.FirstVisibleWritableColumn.");
targetColumnIndex = this.ColumnsInternal.FirstVisibleWritableColumn.Index;
}
}
else
{
targetSlot = this.CurrentSlot;
targetColumnIndex = neighborVisibleWritableColumnIndex;
}
DataGridSelectionAction action;
if (targetSlot != this.CurrentSlot || (this.SelectionMode == DataGridSelectionMode.Extended))
{
if (IsSlotOutOfBounds(targetSlot))
{
return true;
}
action = DataGridSelectionAction.SelectCurrent;
}
else
{
action = DataGridSelectionAction.None;
}
UpdateSelectionAndCurrency(targetColumnIndex, targetSlot, action, true /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
if (_successfullyUpdatedSelection && !this.RowGroupHeadersTable.Contains(targetSlot))
{
BeginCellEdit(e);
}
// Return true to say we handled the key event even if the operation was unsuccessful. If we don't
// say we handled this event, the framework will continue to process the tab key and change focus.
return true;
}
private bool ProcessUpKey(bool shift, bool ctrl)
{
DataGridColumn dataGridColumn = this.ColumnsInternal.FirstVisibleNonFillerColumn;
int firstVisibleColumnIndex = (dataGridColumn == null) ? -1 : dataGridColumn.Index;
int firstVisibleSlot = this.FirstVisibleSlot;
if (firstVisibleColumnIndex == -1 || firstVisibleSlot == -1)
{
return false;
}
if (this.WaitForLostFocus(() => { this.ProcessUpKey(shift, ctrl); }))
{
return true;
}
int previousVisibleSlot = (this.CurrentSlot != -1) ? GetPreviousVisibleSlot(this.CurrentSlot) : -1;
_noSelectionChangeCount++;
try
{
int slot;
int columnIndex;
DataGridSelectionAction action;
if (this.CurrentColumnIndex == -1)
{
slot = firstVisibleSlot;
columnIndex = firstVisibleColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
else if (ctrl)
{
if (shift)
{
// Both Ctrl and Shift
slot = firstVisibleSlot;
columnIndex = this.CurrentColumnIndex;
action = (this.SelectionMode == DataGridSelectionMode.Extended)
? DataGridSelectionAction.SelectFromAnchorToCurrent
: DataGridSelectionAction.SelectCurrent;
}
else
{
// Ctrl without Shift
slot = firstVisibleSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
}
else
{
if (previousVisibleSlot == -1)
{
return true;
}
if (shift)
{
// Shift without Ctrl
slot = previousVisibleSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectFromAnchorToCurrent;
}
else
{
// Neither Shift nor Ctrl
slot = previousVisibleSlot;
columnIndex = this.CurrentColumnIndex;
action = DataGridSelectionAction.SelectCurrent;
}
}
UpdateSelectionAndCurrency(columnIndex, slot, action, true /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
return _successfullyUpdatedSelection;
}
private void RemoveDisplayedColumnHeader(DataGridColumn dataGridColumn)
{
if (_columnHeadersPresenter != null)
{
_columnHeadersPresenter.Children.Remove(dataGridColumn.HeaderCell);
}
}
private void RemoveDisplayedColumnHeaders()
{
if (_columnHeadersPresenter != null)
{
_columnHeadersPresenter.Children.Clear();
}
this.ColumnsInternal.FillerColumn.IsRepresented = false;
}
private bool ResetCurrentCellCore()
{
return this.CurrentColumnIndex == -1 || SetCurrentCellCore(-1, -1);
}
private void ResetEditingRow()
{
DataGridRow oldEditingRow = this.EditingRow;
if (oldEditingRow != null &&
oldEditingRow != _focusedRow &&
!IsSlotVisible(oldEditingRow.Slot))
{
// Unload the old editing row if it's off screen
oldEditingRow.Clip = null;
UnloadRow(oldEditingRow);
this.DisplayData.FullyRecycleElements();
}
this.EditingRow = null;
if (oldEditingRow != null && IsSlotVisible(oldEditingRow.Slot))
{
// If the row is no longer editing, then its visuals need to change.
oldEditingRow.ApplyState(true /*animate*/);
}
}
private void ResetFocusedRow()
{
if (_focusedRow != null &&
_focusedRow != this.EditingRow &&
!IsSlotVisible(_focusedRow.Slot))
{
// Unload the old focused row if it's off screen
_focusedRow.Clip = null;
UnloadRow(_focusedRow);
this.DisplayData.FullyRecycleElements();
}
_focusedRow = null;
}
private void ResetValidationStatus()
{
// Clear the invalid status of the Cell, Row and DataGrid
if (this.EditingRow != null)
{
this.EditingRow.IsValid = true;
if (this.EditingRow.Index != -1)
{
foreach (DataGridCell cell in this.EditingRow.Cells)
{
if (!cell.IsValid)
{
cell.IsValid = true;
cell.ApplyCellState(true);
}
}
this.EditingRow.ApplyState(true);
}
}
this.IsValid = true;
// Clear the previous validation results
_validationResults.Clear();
#if FEATURE_VALIDATION_SUMMARY
// Hide the error list if validation succeeded
if (_validationSummary != null && _validationSummary.Errors.Count > 0)
{
_validationSummary.Errors.Clear();
if (this.EditingRow != null)
{
int editingRowSlot = this.EditingRow.Slot;
InvalidateMeasure();
// TODO: Move to DispatcherQueue when FEATURE_VALIDATION_SUMMARY is enabled
this.Dispatcher.BeginInvoke(() =>
{
// It's possible that the DataContext or ItemsSource has changed by the time we reach this code,
// so we need to ensure that the editing row still exists before scrolling it into view
if (!IsSlotOutOfBounds(editingRowSlot) && editingRowSlot != -1)
{
ScrollSlotIntoView(editingRowSlot, false /*scrolledHorizontally*/);
}
});
}
}
#endif
}
private void RowGroupHeaderStyles_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (_rowsPresenter != null)
{
Style oldLastStyle = _rowGroupHeaderStylesOld.Count > 0 ? _rowGroupHeaderStylesOld[_rowGroupHeaderStylesOld.Count - 1] : null;
while (_rowGroupHeaderStylesOld.Count < _rowGroupHeaderStyles.Count)
{
_rowGroupHeaderStylesOld.Add(oldLastStyle);
}
Style lastStyle = _rowGroupHeaderStyles.Count > 0 ? _rowGroupHeaderStyles[_rowGroupHeaderStyles.Count - 1] : null;
foreach (UIElement element in _rowsPresenter.Children)
{
DataGridRowGroupHeader groupHeader = element as DataGridRowGroupHeader;
if (groupHeader != null)
{
Style oldStyle = groupHeader.Level < _rowGroupHeaderStylesOld.Count ? _rowGroupHeaderStylesOld[groupHeader.Level] : oldLastStyle;
Style newStyle = groupHeader.Level < _rowGroupHeaderStyles.Count ? _rowGroupHeaderStyles[groupHeader.Level] : lastStyle;
EnsureElementStyle(groupHeader, oldStyle, newStyle);
}
}
}
_rowGroupHeaderStylesOld.Clear();
foreach (Style style in _rowGroupHeaderStyles)
{
_rowGroupHeaderStylesOld.Add(style);
}
}
private void SelectAll()
{
SetRowsSelection(0, this.SlotCount - 1);
}
private void SetAndSelectCurrentCell(
int columnIndex,
int slot,
bool forceCurrentCellSelection)
{
DataGridSelectionAction action = forceCurrentCellSelection ? DataGridSelectionAction.SelectCurrent : DataGridSelectionAction.None;
UpdateSelectionAndCurrency(columnIndex, slot, action, false /*scrollIntoView*/);
}
// columnIndex = 2, rowIndex = -1 --> current cell belongs to the 'new row'.
// columnIndex = 2, rowIndex = 2 --> current cell is an inner cell
// columnIndex = -1, rowIndex = -1 --> current cell is reset
// columnIndex = -1, rowIndex = 2 --> Unexpected
private bool SetCurrentCellCore(int columnIndex, int slot, bool commitEdit, bool endRowEdit)
{
DiagnosticsDebug.Assert(columnIndex < this.ColumnsItemsInternal.Count, "Expected columnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(slot < this.SlotCount, "Expected slot smaller than this.SlotCount.");
DiagnosticsDebug.Assert(columnIndex == -1 || this.ColumnsItemsInternal[columnIndex].IsVisible, "Expected columnIndex equals -1 or ColumnsItemsInternal[columnIndex].IsVisible is true.");
DiagnosticsDebug.Assert(columnIndex <= -1 || slot != -1, "Expected columnIndex smaller than or equal to -1 or slot other than -1.");
if (columnIndex == this.CurrentColumnIndex &&
slot == this.CurrentSlot)
{
DiagnosticsDebug.Assert(this.DataConnection != null, "Expected non-null DataConnection.");
DiagnosticsDebug.Assert(_editingColumnIndex == -1 || _editingColumnIndex == this.CurrentColumnIndex, "Expected _editingColumnIndex equals -1 or _editingColumnIndex equals CurrentColumnIndex.");
DiagnosticsDebug.Assert(this.EditingRow == null || this.EditingRow.Slot == this.CurrentSlot || this.DataConnection.EndingEdit, "Expected EditingRow is null or EditingRow.Slot equals CurrentSlot or DataConnection.EndingEdit is true.");
return true;
}
UIElement oldDisplayedElement = null;
DataGridCellCoordinates oldCurrentCell = new DataGridCellCoordinates(this.CurrentCellCoordinates);
object newCurrentItem = null;
if (!this.RowGroupHeadersTable.Contains(slot))
{
int rowIndex = this.RowIndexFromSlot(slot);
if (rowIndex >= 0 && rowIndex < this.DataConnection.Count)
{
newCurrentItem = this.DataConnection.GetDataItem(rowIndex);
}
}
if (this.CurrentColumnIndex > -1)
{
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
if (!IsInnerCellOutOfBounds(oldCurrentCell.ColumnIndex, oldCurrentCell.Slot) &&
this.IsSlotVisible(oldCurrentCell.Slot))
{
oldDisplayedElement = this.DisplayData.GetDisplayedElement(oldCurrentCell.Slot);
}
if (!this.RowGroupHeadersTable.Contains(oldCurrentCell.Slot) && !_temporarilyResetCurrentCell)
{
bool keepFocus = this.ContainsFocus;
if (commitEdit)
{
if (!EndCellEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, keepFocus, true /*raiseEvents*/))
{
return false;
}
// Resetting the current cell: setting it to (-1, -1) is not considered setting it out of bounds
if ((columnIndex != -1 && slot != -1 && IsInnerCellOutOfSelectionBounds(columnIndex, slot)) ||
IsInnerCellOutOfSelectionBounds(oldCurrentCell.ColumnIndex, oldCurrentCell.Slot))
{
return false;
}
if (endRowEdit && !EndRowEdit(DataGridEditAction.Commit, true /*exitEditingMode*/, true /*raiseEvents*/))
{
return false;
}
}
else
{
this.CancelEdit(DataGridEditingUnit.Row, false);
ExitEdit(keepFocus);
}
}
}
if (newCurrentItem != null)
{
slot = this.SlotFromRowIndex(this.DataConnection.IndexOf(newCurrentItem));
}
if (slot == -1 && columnIndex != -1)
{
return false;
}
if (_noFocusedColumnChangeCount == 0)
{
this.ColumnHeaderHasFocus = false;
}
this.CurrentColumnIndex = columnIndex;
this.CurrentSlot = slot;
if (_temporarilyResetCurrentCell)
{
if (columnIndex != -1)
{
_temporarilyResetCurrentCell = false;
}
}
if (!_temporarilyResetCurrentCell && _editingColumnIndex != -1)
{
_editingColumnIndex = columnIndex;
}
if (oldDisplayedElement != null)
{
DataGridRow row = oldDisplayedElement as DataGridRow;
if (row != null)
{
// Don't reset the state of the current cell if we're editing it because that would put it in an invalid state
UpdateCurrentState(oldDisplayedElement, oldCurrentCell.ColumnIndex, !(_temporarilyResetCurrentCell && row.IsEditing && _editingColumnIndex == oldCurrentCell.ColumnIndex));
}
else
{
UpdateCurrentState(oldDisplayedElement, oldCurrentCell.ColumnIndex, false /*applyCellState*/);
}
}
if (this.CurrentColumnIndex > -1)
{
DiagnosticsDebug.Assert(this.CurrentSlot > -1, "Expected CurrentSlot greater than -1.");
DiagnosticsDebug.Assert(this.CurrentColumnIndex < this.ColumnsItemsInternal.Count, "Expected CurrentColumnIndex smaller than ColumnsItemsInternal.Count.");
DiagnosticsDebug.Assert(this.CurrentSlot < this.SlotCount, "Expected CurrentSlot smaller than SlotCount.");
if (this.IsSlotVisible(this.CurrentSlot))
{
UpdateCurrentState(this.DisplayData.GetDisplayedElement(this.CurrentSlot), this.CurrentColumnIndex, true /*applyCellState*/);
}
}
return true;
}
private void SetHorizontalOffset(double newHorizontalOffset)
{
if (_hScrollBar != null && _hScrollBar.Value != newHorizontalOffset)
{
_hScrollBar.Value = newHorizontalOffset;
// Unless the control is still loading, show the scroll bars when an offset changes. Keep the existing indicator type.
if (VisualTreeHelper.GetParent(this) != null)
{
ShowScrollBars();
}
}
}
private void SetVerticalOffset(double newVerticalOffset)
{
VerticalOffset = newVerticalOffset;
if (_vScrollBar != null && !DoubleUtil.AreClose(newVerticalOffset, _vScrollBar.Value))
{
_vScrollBar.Value = _verticalOffset;
// Unless the control is still loading, show the scroll bars when an offset changes. Keep the existing indicator type.
if (VisualTreeHelper.GetParent(this) != null)
{
ShowScrollBars();
}
}
}
#if FEATURE_VALIDATION_SUMMARY
/// <summary>
/// Determines whether or not a specific validation result should be displayed in the ValidationSummary.
/// </summary>
/// <param name="validationResult">Validation result to display.</param>
/// <returns>True if it should be added to the ValidationSummary, false otherwise.</returns>
private bool ShouldDisplayValidationResult(ValidationResult validationResult)
{
if (this.EditingRow != null)
{
return !_bindingValidationResults.ContainsEqualValidationResult(validationResult) ||
this.EditingRow.DataContext is IDataErrorInfo || this.EditingRow.DataContext is INotifyDataErrorInfo;
}
return false;
}
#endif
private void ShowScrollBars()
{
if (this.AreAllScrollBarsCollapsed)
{
_proposedScrollBarsState = ScrollBarVisualState.NoIndicator;
_proposedScrollBarsSeparatorState = ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation;
SwitchScrollBarsVisualStates(_proposedScrollBarsState, _proposedScrollBarsSeparatorState, false /*useTransitions*/);
}
else
{
if (_hideScrollBarsTimer != null && _hideScrollBarsTimer.IsRunning)
{
_hideScrollBarsTimer.Stop();
_hideScrollBarsTimer.Start();
}
// Mouse indicators dominate if they are already showing or if we have set the flag to prefer them.
if (_preferMouseIndicators || _showingMouseIndicators)
{
if (this.AreBothScrollBarsVisible && (_isPointerOverHorizontalScrollBar || _isPointerOverVerticalScrollBar))
{
_proposedScrollBarsState = ScrollBarVisualState.MouseIndicatorFull;
}
else
{
_proposedScrollBarsState = ScrollBarVisualState.MouseIndicator;
}
_showingMouseIndicators = true;
}
else
{
_proposedScrollBarsState = ScrollBarVisualState.TouchIndicator;
}
// Select the proper state for the scroll bars separator square within the GroupScrollBarsSeparator group:
if (UISettingsHelper.AreSettingsEnablingAnimations)
{
// When OS animations are turned on, show the square when a scroll bar is shown unless the DataGrid is disabled, using an animation.
_proposedScrollBarsSeparatorState =
this.IsEnabled &&
_proposedScrollBarsState == ScrollBarVisualState.MouseIndicatorFull ?
ScrollBarsSeparatorVisualState.SeparatorExpanded : ScrollBarsSeparatorVisualState.SeparatorCollapsed;
}
else
{
// OS animations are turned off. Show or hide the square depending on the presence of a scroll bars, without an animation.
// When the DataGrid is disabled, hide the square in sync with the scroll bar(s).
if (_proposedScrollBarsState == ScrollBarVisualState.MouseIndicatorFull)
{
_proposedScrollBarsSeparatorState = this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorExpandedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed;
}
else
{
_proposedScrollBarsSeparatorState = this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed;
}
}
if (!UISettingsHelper.AreSettingsAutoHidingScrollBars)
{
if (this.AreBothScrollBarsVisible)
{
if (UISettingsHelper.AreSettingsEnablingAnimations)
{
SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicatorFull, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorExpanded : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
}
else
{
SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicatorFull, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorExpandedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
}
}
else
{
if (UISettingsHelper.AreSettingsEnablingAnimations)
{
SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicator, ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
}
else
{
SwitchScrollBarsVisualStates(ScrollBarVisualState.MouseIndicator, this.IsEnabled ? ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation : ScrollBarsSeparatorVisualState.SeparatorCollapsed, true /*useTransitions*/);
}
}
}
else
{
SwitchScrollBarsVisualStates(_proposedScrollBarsState, _proposedScrollBarsSeparatorState, true /*useTransitions*/);
}
}
}
private void StopHideScrollBarsTimer()
{
if (_hideScrollBarsTimer != null && _hideScrollBarsTimer.IsRunning)
{
_hideScrollBarsTimer.Stop();
}
}
private void SwitchScrollBarsVisualStates(ScrollBarVisualState scrollBarsState, ScrollBarsSeparatorVisualState separatorState, bool useTransitions)
{
switch (scrollBarsState)
{
case ScrollBarVisualState.NoIndicator:
VisualStates.GoToState(this, useTransitions, VisualStates.StateNoIndicator);
if (!_hasNoIndicatorStateStoryboardCompletedHandler)
{
_showingMouseIndicators = false;
}
break;
case ScrollBarVisualState.TouchIndicator:
VisualStates.GoToState(this, useTransitions, VisualStates.StateTouchIndicator);
break;
case ScrollBarVisualState.MouseIndicator:
VisualStates.GoToState(this, useTransitions, VisualStates.StateMouseIndicator);
break;
case ScrollBarVisualState.MouseIndicatorFull:
VisualStates.GoToState(this, useTransitions, VisualStates.StateMouseIndicatorFull);
break;
}
switch (separatorState)
{
case ScrollBarsSeparatorVisualState.SeparatorCollapsed:
VisualStates.GoToState(this, useTransitions, VisualStates.StateSeparatorCollapsed);
break;
case ScrollBarsSeparatorVisualState.SeparatorExpanded:
VisualStates.GoToState(this, useTransitions, VisualStates.StateSeparatorExpanded);
break;
case ScrollBarsSeparatorVisualState.SeparatorExpandedWithoutAnimation:
VisualStates.GoToState(this, useTransitions, VisualStates.StateSeparatorExpandedWithoutAnimation);
break;
case ScrollBarsSeparatorVisualState.SeparatorCollapsedWithoutAnimation:
VisualStates.GoToState(this, useTransitions, VisualStates.StateSeparatorCollapsedWithoutAnimation);
break;
}
}
private void UnhookHorizontalScrollBarEvents()
{
if (_hScrollBar != null)
{
_hScrollBar.Scroll -= new ScrollEventHandler(HorizontalScrollBar_Scroll);
_hScrollBar.PointerEntered -= new PointerEventHandler(HorizontalScrollBar_PointerEntered);
_hScrollBar.PointerExited -= new PointerEventHandler(HorizontalScrollBar_PointerExited);
}
}
private void UnhookVerticalScrollBarEvents()
{
if (_vScrollBar != null)
{
_vScrollBar.Scroll -= new ScrollEventHandler(VerticalScrollBar_Scroll);
_vScrollBar.PointerEntered -= new PointerEventHandler(VerticalScrollBar_PointerEntered);
_vScrollBar.PointerExited -= new PointerEventHandler(VerticalScrollBar_PointerExited);
}
}
private void UpdateCurrentState(UIElement displayedElement, int columnIndex, bool applyCellState)
{
DataGridRow row = displayedElement as DataGridRow;
if (row != null)
{
if (this.AreRowHeadersVisible)
{
row.ApplyHeaderState(true /*animate*/);
}
DataGridCell cell = row.Cells[columnIndex];
if (applyCellState)
{
cell.ApplyCellState(true /*animate*/);
}
}
else
{
DataGridRowGroupHeader groupHeader = displayedElement as DataGridRowGroupHeader;
if (groupHeader != null)
{
groupHeader.ApplyState(true /*useTransitions*/);
if (this.AreRowHeadersVisible)
{
groupHeader.ApplyHeaderState(true /*animate*/);
}
}
}
}
private void UpdateDisabledVisual()
{
if (this.IsEnabled)
{
VisualStates.GoToState(this, true, VisualStates.StateNormal);
}
else
{
VisualStates.GoToState(this, true, VisualStates.StateDisabled, VisualStates.StateNormal);
}
}
private void UpdateHorizontalScrollBar(bool needHorizScrollBar, bool forceHorizScrollBar, double totalVisibleWidth, double totalVisibleFrozenWidth, double cellsWidth)
{
if (_hScrollBar != null)
{
if (needHorizScrollBar || forceHorizScrollBar)
{
// ..........viewportSize
// v---v
// |<|_____|###|>|
// ^ ^
// min max
// we want to make the relative size of the thumb reflect the relative size of the viewing area
// viewportSize / (max + viewportSize) = cellsWidth / max
// -> viewportSize = max * cellsWidth / (max - cellsWidth)
// always zero
_hScrollBar.Minimum = 0;
if (needHorizScrollBar)
{
// maximum travel distance -- not the total width
_hScrollBar.Maximum = totalVisibleWidth - cellsWidth;
DiagnosticsDebug.Assert(totalVisibleFrozenWidth >= 0, "Expected positive totalVisibleFrozenWidth.");
if (_frozenColumnScrollBarSpacer != null)
{
_frozenColumnScrollBarSpacer.Width = totalVisibleFrozenWidth;
}
DiagnosticsDebug.Assert(_hScrollBar.Maximum >= 0, "Expected positive _hScrollBar.Maximum.");
// width of the scrollable viewing area
double viewPortSize = Math.Max(0, cellsWidth - totalVisibleFrozenWidth);
_hScrollBar.ViewportSize = viewPortSize;
_hScrollBar.LargeChange = viewPortSize;
// The ScrollBar should be in sync with HorizontalOffset at this point. There's a resize case
// where the ScrollBar will coerce an old value here, but we don't want that.
SetHorizontalOffset(_horizontalOffset);
_hScrollBar.IsEnabled = true;
}
else
{
_hScrollBar.Maximum = 0;
_hScrollBar.ViewportSize = 0;
_hScrollBar.IsEnabled = false;
}
if (_hScrollBar.Visibility != Visibility.Visible)
{
// This will trigger a call to this method via Cells_SizeChanged for which no processing is needed.
_hScrollBar.Visibility = Visibility.Visible;
_ignoreNextScrollBarsLayout = true;
if (!this.IsHorizontalScrollBarOverCells && _hScrollBar.DesiredSize.Height == 0)
{
// We need to know the height for the rest of layout to work correctly so measure it now
_hScrollBar.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}
}
}
else
{
_hScrollBar.Maximum = 0;
if (_hScrollBar.Visibility != Visibility.Collapsed)
{
// This will trigger a call to this method via Cells_SizeChanged for which no processing is needed.
_hScrollBar.Visibility = Visibility.Collapsed;
_ignoreNextScrollBarsLayout = true;
}
}
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationScrollEvents();
}
}
}
#if FEATURE_IEDITABLECOLLECTIONVIEW
private void UpdateNewItemPlaceholder()
{
int placeholderSlot = SlotFromRowIndex(this.DataConnection.NewItemPlaceholderIndex);
if (this.DataConnection.NewItemPlaceholderPosition == NewItemPlaceholderPosition.AtEnd &&
_collapsedSlotsTable.Contains(placeholderSlot) != this.IsReadOnly)
{
if (this.IsReadOnly)
{
if (this.SelectedIndex == this.DataConnection.NewItemPlaceholderIndex)
{
this.SelectedIndex = Math.Max(-1, this.DataConnection.Count - 2);
}
if (this.IsSlotVisible(SlotFromRowIndex(this.DataConnection.NewItemPlaceholderIndex)))
{
this.RemoveDisplayedElement(placeholderSlot, false, true);
this.InvalidateRowsArrange();
}
_collapsedSlotsTable.AddValue(placeholderSlot, Visibility.Collapsed);
}
else
{
_collapsedSlotsTable.RemoveValue(placeholderSlot);
}
this.VisibleSlotCount = this.SlotCount - _collapsedSlotsTable.GetIndexCount(0, this.SlotCount - 1);
this.ComputeScrollBarsLayout();
}
}
#endif
private void UpdateRowDetailsVisibilityMode(DataGridRowDetailsVisibilityMode newDetailsMode)
{
if (_rowsPresenter != null && this.DataConnection.Count > 0)
{
Visibility newDetailsVisibility = Visibility.Collapsed;
switch (newDetailsMode)
{
case DataGridRowDetailsVisibilityMode.Visible:
newDetailsVisibility = Visibility.Visible;
break;
case DataGridRowDetailsVisibilityMode.Collapsed:
newDetailsVisibility = Visibility.Collapsed;
break;
case DataGridRowDetailsVisibilityMode.VisibleWhenSelected:
break;
}
this.ClearShowDetailsTable();
bool updated = false;
foreach (DataGridRow row in this.GetAllRows())
{
if (row.Visibility == Visibility.Visible)
{
if (newDetailsMode == DataGridRowDetailsVisibilityMode.VisibleWhenSelected)
{
// For VisibleWhenSelected, we need to calculate the value for each individual row
newDetailsVisibility = _selectedItems.ContainsSlot(row.Slot) && row.Index != this.DataConnection.NewItemPlaceholderIndex ? Visibility.Visible : Visibility.Collapsed;
}
if (row.DetailsVisibility != newDetailsVisibility)
{
updated = true;
row.SetDetailsVisibilityInternal(
newDetailsVisibility,
true /*raiseNotification*/);
}
}
}
if (updated)
{
UpdateDisplayedRows(this.DisplayData.FirstScrollingSlot, this.CellsHeight);
InvalidateRowsMeasure(false /*invalidateIndividualElements*/);
}
}
}
private void UpdateRowsPresenterManipulationMode(bool horizontalMode, bool verticalMode)
{
if (_rowsPresenter != null)
{
ManipulationModes manipulationMode = _rowsPresenter.ManipulationMode;
if (horizontalMode)
{
if (this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled)
{
manipulationMode |= ManipulationModes.TranslateX | ManipulationModes.TranslateInertia;
}
else
{
manipulationMode &= ~(ManipulationModes.TranslateX | ManipulationModes.TranslateRailsX);
}
}
if (verticalMode)
{
if (this.VerticalScrollBarVisibility != ScrollBarVisibility.Disabled)
{
manipulationMode |= ManipulationModes.TranslateY | ManipulationModes.TranslateInertia;
}
else
{
manipulationMode &= ~(ManipulationModes.TranslateY | ManipulationModes.TranslateRailsY);
}
}
if ((manipulationMode & (ManipulationModes.TranslateX | ManipulationModes.TranslateY)) == (ManipulationModes.TranslateX | ManipulationModes.TranslateY))
{
manipulationMode |= ManipulationModes.TranslateRailsX | ManipulationModes.TranslateRailsY;
}
if ((manipulationMode & (ManipulationModes.TranslateX | ManipulationModes.TranslateRailsX | ManipulationModes.TranslateY | ManipulationModes.TranslateRailsY)) ==
ManipulationModes.None)
{
manipulationMode &= ~ManipulationModes.TranslateInertia;
}
_rowsPresenter.ManipulationMode = manipulationMode;
}
}
private bool UpdateStateOnTapped(TappedRoutedEventArgs args, int columnIndex, int slot, bool allowEdit, bool shift, bool ctrl)
{
bool beginEdit;
DiagnosticsDebug.Assert(slot >= 0, "Expected positive slot.");
// Before changing selection, check if the current cell needs to be committed, and
// check if the current row needs to be committed. If any of those two operations are required and fail,
// do not change selection, and do not change current cell.
bool wasInEdit = this.EditingColumnIndex != -1;
if (IsSlotOutOfBounds(slot))
{
return true;
}
if (wasInEdit && (columnIndex != this.EditingColumnIndex || slot != this.CurrentSlot) &&
this.WaitForLostFocus(() => { this.UpdateStateOnTapped(args, columnIndex, slot, allowEdit, shift, ctrl); }))
{
return true;
}
try
{
_noSelectionChangeCount++;
beginEdit = allowEdit &&
this.CurrentSlot == slot &&
columnIndex != -1 &&
(wasInEdit || this.CurrentColumnIndex == columnIndex) &&
!GetColumnEffectiveReadOnlyState(this.ColumnsItemsInternal[columnIndex]);
DataGridSelectionAction action;
if (this.SelectionMode == DataGridSelectionMode.Extended && shift)
{
// Shift select multiple rows.
action = DataGridSelectionAction.SelectFromAnchorToCurrent;
}
else if (GetRowSelection(slot))
{
// Unselecting single row or Selecting a previously multi-selected row.
if (!ctrl && this.SelectionMode == DataGridSelectionMode.Extended && _selectedItems.Count != 0)
{
// Unselect everything except the row that was clicked on.
action = DataGridSelectionAction.SelectCurrent;
}
else if (ctrl && this.EditingRow == null)
{
action = DataGridSelectionAction.RemoveCurrentFromSelection;
}
else
{
action = DataGridSelectionAction.None;
}
}
else
{
// Selecting a single row or multi-selecting with Ctrl.
if (this.SelectionMode == DataGridSelectionMode.Single || !ctrl)
{
// Unselect the correctly selected rows except the new selected row.
action = DataGridSelectionAction.SelectCurrent;
}
else
{
action = DataGridSelectionAction.AddCurrentToSelection;
}
}
UpdateSelectionAndCurrency(columnIndex, slot, action, false /*scrollIntoView*/);
}
finally
{
this.NoSelectionChangeCount--;
}
if (_successfullyUpdatedSelection && beginEdit && BeginCellEdit(args))
{
FocusEditingCell(true /*setFocus*/);
}
return true;
}
/// <summary>
/// Updates the DataGrid's validation results, modifies the ValidationSummary's items,
/// and sets the IsValid states of the UIElements.
/// </summary>
/// <param name="newValidationResults">New validation results.</param>
/// <param name="scrollIntoView">If the validation results have changed, scrolls the editing row into view.</param>
private void UpdateValidationResults(List<ValidationResult> newValidationResults, bool scrollIntoView)
{
bool validationResultsChanged = false;
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
// Remove the validation results that have been fixed
List<ValidationResult> removedValidationResults = new List<ValidationResult>();
foreach (ValidationResult oldValidationResult in _validationResults)
{
if (oldValidationResult != null && !newValidationResults.ContainsEqualValidationResult(oldValidationResult))
{
removedValidationResults.Add(oldValidationResult);
validationResultsChanged = true;
}
}
foreach (ValidationResult removedValidationResult in removedValidationResults)
{
_validationResults.Remove(removedValidationResult);
#if FEATURE_VALIDATION_SUMMARY
if (_validationSummary != null)
{
ValidationSummaryItem removedValidationSummaryItem = this.FindValidationSummaryItem(removedValidationResult);
if (removedValidationSummaryItem != null)
{
_validationSummary.Errors.Remove(removedValidationSummaryItem);
}
}
#endif
}
// Add any validation results that were just introduced
foreach (ValidationResult newValidationResult in newValidationResults)
{
if (newValidationResult != null && !_validationResults.ContainsEqualValidationResult(newValidationResult))
{
_validationResults.Add(newValidationResult);
#if FEATURE_VALIDATION_SUMMARY
if (_validationSummary != null && ShouldDisplayValidationResult(newValidationResult))
{
ValidationSummaryItem newValidationSummaryItem = this.CreateValidationSummaryItem(newValidationResult);
if (newValidationSummaryItem != null)
{
_validationSummary.Errors.Add(newValidationSummaryItem);
}
}
#endif
validationResultsChanged = true;
}
}
if (validationResultsChanged)
{
this.UpdateValidationStatus();
}
if (!this.IsValid && scrollIntoView)
{
// Scroll the row with the error into view.
int editingRowSlot = this.EditingRow.Slot;
#if FEATURE_VALIDATION_SUMMARY
if (_validationSummary != null)
{
// If the number of errors has changed, then the ValidationSummary will be a different size,
// and we need to delay our call to ScrollSlotIntoView
this.InvalidateMeasure();
// TODO: Move to DispatcherQueue when FEATURE_VALIDATION_SUMMARY is enabled
this.Dispatcher.BeginInvoke(() =>
{
// It's possible that the DataContext or ItemsSource has changed by the time we reach this code,
// so we need to ensure that the editing row still exists before scrolling it into view
if (!this.IsSlotOutOfBounds(editingRowSlot) && editingRowSlot != -1)
{
this.ScrollSlotIntoView(editingRowSlot, false /*scrolledHorizontally*/);
}
});
}
else
#endif
{
this.ScrollSlotIntoView(editingRowSlot, false /*scrolledHorizontally*/);
}
}
}
/// <summary>
/// Updates the IsValid states of the DataGrid, the EditingRow and its cells. All cells related to
/// property-level errors are set to Invalid. If there is an object-level error selected in the
/// ValidationSummary, then its associated cells will also be flagged (if there are any).
/// </summary>
private void UpdateValidationStatus()
{
if (this.EditingRow != null)
{
foreach (DataGridCell cell in this.EditingRow.Cells)
{
bool isCellValid = true;
DiagnosticsDebug.Assert(cell.OwningColumn != null, "Expected cell has owning column.");
if (!cell.OwningColumn.IsReadOnly)
{
foreach (ValidationResult validationResult in _validationResults)
{
bool validationResultIsSelectedValidationSummaryItemContext = false;
#if FEATURE_VALIDATION_SUMMARY
validationResultIsSelectedValidationSummaryItemContext = _selectedValidationSummaryItem != null && _selectedValidationSummaryItem.Context == validationResult;
#endif
if (_propertyValidationResults.ContainsEqualValidationResult(validationResult) ||
validationResultIsSelectedValidationSummaryItemContext)
{
foreach (string bindingPath in validationResult.MemberNames)
{
if (cell.OwningColumn.BindingPaths.Contains(bindingPath))
{
isCellValid = false;
break;
}
}
}
}
}
if (cell.IsValid != isCellValid)
{
cell.IsValid = isCellValid;
cell.ApplyCellState(true /*animate*/);
}
}
bool isRowValid = _validationResults.Count == 0;
if (this.EditingRow.IsValid != isRowValid)
{
this.EditingRow.IsValid = isRowValid;
this.EditingRow.ApplyState(true /*animate*/);
}
this.IsValid = isRowValid;
}
else
{
this.IsValid = true;
}
}
private void UpdateVerticalScrollBar(bool needVertScrollBar, bool forceVertScrollBar, double totalVisibleHeight, double cellsHeight)
{
if (_vScrollBar != null)
{
if (needVertScrollBar || forceVertScrollBar)
{
// ..........viewportSize
// v---v
// |<|_____|###|>|
// ^ ^
// min max
// we want to make the relative size of the thumb reflect the relative size of the viewing area
// viewportSize / (max + viewportSize) = cellsWidth / max
// -> viewportSize = max * cellsHeight / (totalVisibleHeight - cellsHeight)
// -> = max * cellsHeight / (totalVisibleHeight - cellsHeight)
// -> = max * cellsHeight / max
// -> = cellsHeight
// always zero
_vScrollBar.Minimum = 0;
if (needVertScrollBar && !double.IsInfinity(cellsHeight))
{
// maximum travel distance -- not the total height
_vScrollBar.Maximum = totalVisibleHeight - cellsHeight;
DiagnosticsDebug.Assert(_vScrollBar.Maximum >= 0, "Expected positive _vScrollBar.Maximum.");
// total height of the display area
_vScrollBar.ViewportSize = cellsHeight;
_vScrollBar.LargeChange = cellsHeight;
_vScrollBar.IsEnabled = true;
}
else
{
_vScrollBar.Maximum = 0;
_vScrollBar.ViewportSize = 0;
_vScrollBar.IsEnabled = false;
}
if (_vScrollBar.Visibility != Visibility.Visible)
{
// This will trigger a call to this method via Cells_SizeChanged for which no processing is needed.
_vScrollBar.Visibility = Visibility.Visible;
_ignoreNextScrollBarsLayout = true;
if (!this.IsVerticalScrollBarOverCells && _vScrollBar.DesiredSize.Width == 0)
{
// We need to know the width for the rest of layout to work correctly so measure it now.
_vScrollBar.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}
}
}
else
{
_vScrollBar.Maximum = 0;
if (_vScrollBar.Visibility != Visibility.Collapsed)
{
// This will trigger a call to this method via Cells_SizeChanged for which no processing is needed.
_vScrollBar.Visibility = Visibility.Collapsed;
_ignoreNextScrollBarsLayout = true;
}
}
DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
if (peer != null)
{
peer.RaiseAutomationScrollEvents();
}
}
}
/// <summary>
/// Validates the current editing row and updates the visual states.
/// </summary>
/// <param name="scrollIntoView">If true, will scroll the editing row into view when a new error is introduced.</param>
/// <param name="wireEvents">If true, subscribes to the asynchronous INDEI ErrorsChanged events.</param>
/// <returns>True if the editing row is valid, false otherwise.</returns>
private bool ValidateEditingRow(bool scrollIntoView, bool wireEvents)
{
List<ValidationResult> validationResults;
if (_initializingNewItem)
{
// We only want to run property validation if we're initializing a new item. Instead of
// clearing all the errors, we will only remove those associated with the current column.
validationResults = new List<ValidationResult>(_validationResults);
}
else
{
// We're going to run full entity-level validation, so throw away the
// old errors since they will be recreated if they're still active.
_propertyValidationResults.Clear();
_indeiValidationResults.Clear();
validationResults = new List<ValidationResult>();
}
if (this.EditingRow != null)
{
object dataItem = this.EditingRow.DataContext;
DiagnosticsDebug.Assert(dataItem != null, "Expected non-null dataItem.");
if (!_initializingNewItem)
{
// Validate using the Validator.
ValidationContext context = new ValidationContext(dataItem, null, null);
Validator.TryValidateObject(dataItem, context, validationResults, true);
#if FEATURE_IDATAERRORINFO
// IDEI entity validation.
this.ValidateIdei(dataItem as IDataErrorInfo, null, null, validationResults);
#endif
// INDEI entity validation.
this.ValidateIndei(dataItem as INotifyDataErrorInfo, null, null, null, validationResults, wireEvents);
}
// IDEI and INDEI property validation.
foreach (DataGridColumn column in this.ColumnsInternal.GetDisplayedColumns(c => c.IsVisible && !c.IsReadOnly))
{
if (!_initializingNewItem || column == this.CurrentColumn)
{
foreach (string bindingPath in column.BindingPaths)
{
string declaringPath = null;
object declaringItem = dataItem;
string bindingProperty = bindingPath;
// Check for nested paths.
int lastIndexOfSeparator = bindingPath.LastIndexOfAny(new char[] { TypeHelper.PropertyNameSeparator, TypeHelper.LeftIndexerToken });
if (lastIndexOfSeparator >= 0)
{
declaringPath = bindingPath.Substring(0, lastIndexOfSeparator);
declaringItem = TypeHelper.GetNestedPropertyValue(dataItem, declaringPath);
if (bindingProperty[lastIndexOfSeparator] == TypeHelper.LeftIndexerToken)
{
bindingProperty = TypeHelper.PrependDefaultMemberName(declaringItem, bindingPath.Substring(lastIndexOfSeparator));
}
else
{
bindingProperty = bindingPath.Substring(lastIndexOfSeparator + 1);
}
}
if (_initializingNewItem)
{
// We're only re-validating the current column, so remove its old errors
// because we're about to check if they're still relevant.
foreach (ValidationResult oldValidationResult in _validationResults)
{
if (oldValidationResult != null && oldValidationResult.ContainsMemberName(bindingPath))
{
validationResults.Remove(oldValidationResult);
_indeiValidationResults.Remove(oldValidationResult);
_propertyValidationResults.Remove(oldValidationResult);
}
}
}
#if FEATURE_IDATAERRORINFO
// IDEI property validation.
this.ValidateIdei(declaringItem as IDataErrorInfo, bindingProperty, bindingPath, validationResults);
#endif
// INDEI property validation.
this.ValidateIndei(declaringItem as INotifyDataErrorInfo, bindingProperty, bindingPath, declaringPath, validationResults, wireEvents);
}
}
}
// Add any existing exception errors (in case we're editing a cell).
// Note: these errors will only be displayed in the ValidationSummary if the
// editing data item implements IDEI or INDEI.
foreach (ValidationResult validationResult in _bindingValidationResults)
{
validationResults.AddIfNew(validationResult);
_propertyValidationResults.AddIfNew(validationResult);
}
// Merge the new validation results with the existing ones.
this.UpdateValidationResults(validationResults, scrollIntoView);
// Return false if there are validation errors.
if (!this.IsValid)
{
return false;
}
}
// Return true if there are no errors or there is no editing row.
this.ResetValidationStatus();
return true;
}
#if FEATURE_IDATAERRORINFO
/// <summary>
/// Checks an IDEI data object for errors for the specified property. New errors are added to the
/// list of validation results.
/// </summary>
/// <param name="idei">IDEI object to validate.</param>
/// <param name="bindingProperty">Name of the property to validate.</param>
/// <param name="bindingPath">Path of the binding.</param>
/// <param name="validationResults">List of results to add to.</param>
private void ValidateIdei(IDataErrorInfo idei, string bindingProperty, string bindingPath, List<ValidationResult> validationResults)
{
if (idei != null)
{
string errorString = null;
if (string.IsNullOrEmpty(bindingProperty))
{
DiagnosticsDebug.Assert(string.IsNullOrEmpty(bindingPath));
ValidationUtil.CatchNonCriticalExceptions(() => { errorString = idei.Error; });
if (!string.IsNullOrEmpty(errorString))
{
validationResults.AddIfNew(new ValidationResult(errorString));
}
}
else
{
ValidationUtil.CatchNonCriticalExceptions(() => { errorString = idei[bindingProperty]; });
if (!string.IsNullOrEmpty(errorString))
{
ValidationResult validationResult = new ValidationResult(errorString, new List<string>() { bindingPath });
validationResults.AddIfNew(validationResult);
_propertyValidationResults.Add(validationResult);
}
}
}
}
#endif
/// <summary>
/// Checks an INDEI data object for errors on the specified path. New errors are added to the
/// list of validation results.
/// </summary>
/// <param name="indei">INDEI object to validate.</param>
/// <param name="bindingProperty">Name of the property to validate.</param>
/// <param name="bindingPath">Path of the binding.</param>
/// <param name="declaringPath">Path of the INDEI object.</param>
/// <param name="validationResults">List of results to add to.</param>
/// <param name="wireEvents">True if the ErrorsChanged event should be subscribed to.</param>
private void ValidateIndei(INotifyDataErrorInfo indei, string bindingProperty, string bindingPath, string declaringPath, List<ValidationResult> validationResults, bool wireEvents)
{
if (indei != null)
{
if (indei.HasErrors)
{
IEnumerable errors = null;
ValidationUtil.CatchNonCriticalExceptions(() => { errors = indei.GetErrors(bindingProperty); });
if (errors != null)
{
foreach (object errorItem in errors)
{
if (errorItem != null)
{
string errorString = null;
ValidationUtil.CatchNonCriticalExceptions(() => { errorString = errorItem.ToString(); });
if (!string.IsNullOrEmpty(errorString))
{
ValidationResult validationResult;
if (!string.IsNullOrEmpty(bindingProperty))
{
validationResult = new ValidationResult(errorString, new List<string>() { bindingPath });
_propertyValidationResults.Add(validationResult);
}
else
{
DiagnosticsDebug.Assert(string.IsNullOrEmpty(bindingPath), "Expected bindingPath is null or empty.");
validationResult = new ValidationResult(errorString);
}
validationResults.AddIfNew(validationResult);
_indeiValidationResults.AddIfNew(validationResult);
}
}
}
}
}
if (wireEvents && !_validationItems.ContainsKey(indei))
{
_validationItems.Add(indei, declaringPath);
indei.ErrorsChanged += new EventHandler<DataErrorsChangedEventArgs>(ValidationItem_ErrorsChanged);
}
}
}
/// <summary>
/// Handles the asynchronous INDEI errors that occur while the DataGrid is in editing mode.
/// </summary>
/// <param name="sender">INDEI item whose errors changed.</param>
/// <param name="e">Error event arguments.</param>
private void ValidationItem_ErrorsChanged(object sender, DataErrorsChangedEventArgs e)
{
INotifyDataErrorInfo indei = sender as INotifyDataErrorInfo;
if (_validationItems.ContainsKey(indei))
{
DiagnosticsDebug.Assert(this.EditingRow != null, "Expected non-null EditingRow.");
// Determine the binding path.
string bindingPath = _validationItems[indei];
if (string.IsNullOrEmpty(bindingPath))
{
bindingPath = e.PropertyName;
}
else if (!string.IsNullOrEmpty(e.PropertyName) && e.PropertyName.IndexOf(TypeHelper.LeftIndexerToken) >= 0)
{
bindingPath += TypeHelper.RemoveDefaultMemberName(e.PropertyName);
}
else
{
bindingPath += TypeHelper.PropertyNameSeparator + e.PropertyName;
}
// Remove the old errors.
List<ValidationResult> validationResults = new List<ValidationResult>();
foreach (ValidationResult validationResult in _validationResults)
{
ValidationResult oldValidationResult = _indeiValidationResults.FindEqualValidationResult(validationResult);
if (oldValidationResult != null && oldValidationResult.ContainsMemberName(bindingPath))
{
_indeiValidationResults.Remove(oldValidationResult);
}
else
{
validationResults.Add(validationResult);
}
}
// Find any new errors and update the visuals.
this.ValidateIndei(indei, e.PropertyName, bindingPath, null, validationResults, false /*wireEvents*/);
this.UpdateValidationResults(validationResults, false /*scrollIntoView*/);
// If we're valid now then reset our status.
if (this.IsValid)
{
this.ResetValidationStatus();
}
}
else if (indei != null)
{
indei.ErrorsChanged -= new EventHandler<DataErrorsChangedEventArgs>(ValidationItem_ErrorsChanged);
}
}
private void VerticalScrollBar_Scroll(object sender, ScrollEventArgs e)
{
ProcessVerticalScroll(e.ScrollEventType);
}
}
}
``` |
This is a list of French television related events from 2005.
Events
15 March - Ortal is selected to represent France at the 2005 Eurovision Song Contest with her song "Chacun pense à soi". She is selected to be the forty-eighth French Eurovision entry during a national final held at the La Plaine-St-Denis Studios in Paris.
31 March - France 4 starts broadcasting.
12 May - Myriam Abel wins the third series of Nouvelle Star, becoming the show's first female winner.
16 December - Magalie Vaé wins the fifth series of Star Academy.
Debuts
22 October - 5, Rue Sésame (2005-2007)
24 December- Yakari
Television shows
1940s
Le Jour du Seigneur (1949–present)
1950s
Présence protestante (1955-)
1970s
30 millions d'amis (1976-2016)
1990s
Sous le soleil (1996-2008)
2000s
Star Academy (2001-2008, 2012-2013)
Nouvelle Star (2003-2010, 2012–present)
Plus belle la vie (2004–present)
Ending this year
Births
Deaths
See also
2005 in France |
Peter James Sanguesa Cooper is a film producer and businessman.
Entertainment
Cooper produced the independent romantic comedy film, Love and Mary, starring Lauren German and Gabriel Mann. The film was written and directed for the screen by Elizabeth Harrison, and filmed entirely in Houston, Texas. Love and Mary premiered at the South by Southwest film festival in Austin, Texas on March 11, 2007. It was also featured at the Hollywood Film Festival on October 19, 2007.
He is also the executive producer of the independent feature film This Is What Remains, written and directed by Ben Wagner. This Is What Remains is a psychological thriller produced by 3:41am Productions. The film has been acquired by Millennium Entertainment for U.S. domestic distribution.
Business
Cooper is the co-founder of Crave Cupcakes in Houston, Texas. Crave Cupcakes is a gourmet cupcake bakery designed by the design firm AvroKO of New York City. Cooper created the Crave brand name and the vintage mixer logo identity, as well as having a hand in the overall design of the bakery concept.
References
External links
Love and Mary Trailer
Crave Cupcakes
American film producers
Living people
Place of birth missing (living people)
Year of birth missing (living people) |
The MLW World Women's Featherweight Championship is a women's professional wrestling championship created and promoted by the American professional wrestling promotion Major League Wrestling (MLW). The current champion is Janai Kai who is in her first reign.
History
MLW previously teased the formation of a women's division on August 18, 2019, later announcing its official launch on October 18, 2019. The division's first official match was held at MLW Blood and Thunder of 2019 between Zeda Zhang and The Spider Lady which Zhang was successful at winning via disqualification.
Following MLW coming back from a lengthy hiatus due to the COVID-19 pandemic, on July 7, 2021, it was announced that Shimmer Women Athletes co-founder Dave Prazak had joined MLW to help relaunch its women's division. On the September 22, 2021, episode of Fusion: Alpha, MLW officially announced the launch of its MLW women's featherweight division and introduced the first wrestlers on the roster, including Brittany Blake, Holidead, Nicole Savoy, The Sea Stars (Ashley Vox and Delmi Exo), Willow Nightingale and Zoey Skye.
On April 21, 2022, it was announced that on May 13, 2022, at Kings of Colosseum that there will be a match between Taya Valkyrie and Holidead to determine who the first ever MLW Women's Featherweight Championship title holder is. During the match, Taya defeated Holidead via submission to become the inaugural championship holder.
Sometime during Taya Valkyrie's reign, the title's name was changed from the MLW Women's Featherweight Championship to the MLW World Women's Featherweight Championship according to MLW's official website.
Reigns
Names
See also
World Women's Championship (disambiguation)
References
External links
MLW World Women's Featherweight Championship Title History at Cagematch.net
2022 introductions
Women's
Women's professional wrestling championships |
George Lisle Crowther (18 April 1892 – 1957) was an English professional footballer who played as a forward in the Football League for Hartlepools United, Tranmere Rovers, Bradford Park Avenue, West Ham United and Huddersfield Town.
Personal life
Crowther served as a private in the Football Battalion and the Labour Corps during the First World War. He was awarded the Military Medal for his gallantry during the Football Battalion's during the first major action near Souchez on 1 June 1916.
Career statistics
References
1892 births
Footballers from County Durham
English men's footballers
Men's association football inside forwards
English Football League players
Huddersfield Town A.F.C. players
Rotherham Town F.C. (1899) players
Men's association football forwards
Shildon A.F.C. players
1957 deaths
Halifax Town A.F.C. players
Ashton United F.C. players
Bradford (Park Avenue) A.F.C. players
West Ham United F.C. players
Hartlepool United F.C. players
Tranmere Rovers F.C. players
British Army personnel of World War I
Middlesex Regiment soldiers
Date of death missing
People from Bishop Middleham
External links
Royal Pioneer Corps soldiers
Recipients of the Military Medal |
Barrier Canyon Style (BCS) describes a distinctive style of rock art which appears mostly in Utah, with the largest concentration of sites in and around the San Rafael Swell and Canyonlands National Park, but the full range extends into much of the state and western Colorado. The term was first applied by Polly Schaafsma (The Rock Art of Utah, 1971) to describe a handful of similar sites known at the time, including several along Barrier Creek in Horseshoe Canyon (formerly known as Barrier Canyon). Barrier Canyon Style rock art panels are mostly pictographs (painted) but there are also several petroglyphs (pecked) in the style. These panels are believed to have been created during the archaic period (probably late archaic) and are estimated (from direct and indirect carbon 14 dates) to be somewhere in the range of 1500 to 4000 years old, possibly older -- clay figurines of a similar style found in Cowboy Cave (in a tributary canyon to Horseshoe Canyon) have been dated to over 7000 years old.
Sites
Horseshoe Canyon
Buckhorn Draw Pictograph Panel
Courthouse Wash Pictographs in Arches National Park
Sego Canyon
References
Traces of a Lost People, By Kurt Repanshek, Smithsonian magazine, March 2005
Canyonlands National Park - Archeology of Horseshoe Canyon, National Park Service
Barrier Canyon Style Rock Art Gallery and Singing Desert Barrier Canyon Style pages, photos of Barrier Canyon Style rock art by Doak Heyser.
Rock art in North America
Petroglyphs in Utah |
Stackhouse is a surname. Notable people and characters with the name include:
People
Charles Stackhouse (born 1980), American football player
Eleanor Stackhouse Atkinson (1863–1942), American author, journalist and teacher
Eli T. Stackhouse (1824–1892), U.S. Representative from South Carolina
Emily Stackhouse (1811–1870), Cornish botanical illustrator
Houston Stackhouse (1910–1980) American Delta blues guitarist and singer
Jerry Stackhouse (born 1974), American professional basketball player
John Stackhouse (disambiguation), multiple people, including:
John G. Stackhouse, Jr. (born 1960), Canadian scholar and writer
John Stackhouse (botanist) (1742–1819), English botanist
John Stackhouse (colonial administrator), administrator of the English East India Company
John Stackhouse (Globe and Mail) (born 1962), Canadian journalist and author
Max Lynn Stackhouse (1935–2016), professor at Princeton Theological Seminary
Reginald Stackhouse (1925–2016), Canadian educator and former politician
Robert Stackhouse (born 1942), American artist and sculptor
Ron Stackhouse (born 1949), Canadian ice hockey defenseman
Ted Stackhouse (1894–1975), Canadian ice hockey defenceman
Thomas Stackhouse (1677–1752), English theologian and controversialist
Thomas Stackhouse (antiquary) (1756–1836), English educational writer and antiquary, grandson of the theologian Thomas Stackhouse
Fictional characters
Adele Stackhouse, character in The Southern Vampire Mysteries and True Blood
Jason Stackhouse, character in The Southern Vampire Mysteries and True Blood
Lt. Jeremy Stackhouse, a character in the 2001 film Behind Enemy Lines
Sookie Stackhouse, the main character in The Southern Vampire Mysteries and True Blood
See also
Stackhouse, North Yorkshire, England
Stackhouse Park, Westmont, Pennsylvania
English-language surnames
Surnames of English origin |
The Battle of Mount Falernus was a battle during the early stages of the Social War. It was a victory for the Italian rebels causing the Roman army under Pompey Strabo to retreat. The rebels pursued them and besieged them at Firmum. Some have argued that the different accounts of the battle are instead two separate Roman defeats.
References
Mount Falernus |
Mun Kyung-gun (; born February 9, 1995) is a South Korean football player who plays for Gimcheon Sangmu.
Playing career
Mun joined J2 League club Oita Trinita in 2017. On June 6, 2018, he debuted against Renofa Yamaguchi FC in Emperor's Cup.
Career statistics
Last update: 27 February 2019
References
External links
1995 births
Living people
South Korean men's footballers
J1 League players
J2 League players
Oita Trinita players
Men's association football goalkeepers |
Ertis (, Ertıs) is a selo in northern Kazakhstan. It is the administrative center of Ertis District in Pavlodar Region. Population: . It is situated on the left bank of the Irtysh River.
Climate
References
Populated places in Pavlodar Region
Populated places on the Irtysh River |
```python
#
#
#
# path_to_url
#
# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
import torch
import time
import argparse
from ipex_llm.transformers import AutoModelForCausalLM
from transformers import AutoTokenizer
# prompt format referred from path_to_url
# and path_to_url#L7-L49
# For English prompt, you are recommended to change the prompt format.
BAICHUAN_PROMPT_FORMAT = "<reserved_106> {prompt} <reserved_107>"
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for Baichuan model')
parser.add_argument('--repo-id-or-model-path', type=str, default="baichuan-inc/Baichuan2-7B-Chat",
help='The huggingface repo id for the Baichuan model to be downloaded'
', or the path to the huggingface checkpoint folder')
parser.add_argument('--prompt', type=str, default="AI",
help='Prompt to infer')
parser.add_argument('--n-predict', type=int, default=32,
help='Max tokens to predict')
args = parser.parse_args()
model_path = args.repo_id_or_model_path
# Load model in 4 bit,
# which convert the relevant layers in the model into INT4 format
# if your selected model is capable of utilizing previous key/value attentions
# to enhance decoding speed, but has `"use_cache": false` in its model config,
# it is important to set `use_cache=True` explicitly in the `generate` function
# to obtain optimal performance with IPEX-LLM INT4 optimizations
# When running LLMs on Intel iGPUs for Windows users, we recommend setting `cpu_embedding=True` in the from_pretrained function.
# This will allow the memory-intensive embedding layer to utilize the CPU instead of iGPU.
model = AutoModelForCausalLM.from_pretrained(model_path,
load_in_4bit=True,
trust_remote_code=True,
use_cache=True)
model = model.half().to('xpu')
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_path,
trust_remote_code=True)
# Generate predicted tokens
with torch.inference_mode():
prompt = BAICHUAN_PROMPT_FORMAT.format(prompt=args.prompt)
input_ids = tokenizer.encode(prompt, return_tensors="pt").to('xpu')
# ipex_llm model needs a warmup, then inference time can be accurate
output = model.generate(input_ids,
max_new_tokens=args.n_predict)
# start inference
st = time.time()
output = model.generate(input_ids,
max_new_tokens=args.n_predict)
torch.xpu.synchronize()
end = time.time()
output = output.cpu()
output_str = tokenizer.decode(output[0], skip_special_tokens=True)
print(f'Inference time: {end-st} s')
print('-'*20, 'Prompt', '-'*20)
print(prompt)
print('-'*20, 'Output', '-'*20)
print(output_str)
``` |
Lorenzo Dechalus (born September 17, 1968), known professionally as Lord Jamar is an American rapper, DJ, record producer, actor and podcaster. He is a founding member of the hip hop group Brand Nubian, which was formed in 1989. In 1996, he discovered Dead Prez and got them signed to Loud Records.
Early life
Jamar was born in The Bronx, New York City, but was raised in New Rochelle, New York. Jamar has Afro-Guyanese heritage on his father's side, and he is the eldest of three brothers. He was introduced to hip hop music in the 1970s through a friend who lived in his neighborhood, and he would listen to tapes of The Cold Crush Brothers, Grandmaster Flash and the Furious Five and The Sugarhill Gang. DJ Daryll C of Crash Crew used to take Jamar to hip hop shows in New York City. Jamar sold crack cocaine during his teen years, but stopped after people he knew received sealed indictments. He dropped out of high school after failing ninth grade, and worked a few short-term jobs prior to signing a record deal.
Career
Brand Nubian's debut studio album, One for All, was released in 1990 and is regarded as one of the greatest hip hop albums released during that time.
Brand Nubian's third studio album, Everything is Everything was released in 1994. In 1996, he discovered Dead Prez and got them signed to Loud Records. As an actor, Jamar is best known for his role of Supreme Allah on the TV series Oz. He has appeared on Law & Order: Special Victims Unit, Third Watch, and The Sopranos. He has also worked as a producer for artists such as Dead Prez, Buckshot, Shaka Amazulu the 7th and Tom Browne.
He released his debut solo album The 5% Album (an album dedicated to the Nation of Gods and Earths) on June 27, 2006. Like his onscreen character on Oz, Jamar is a member of the Nation of Gods and Earths.
Jamar currently co-hosts a podcast, Yanadameen Godcast, with fellow rapper Rah Digga. He has criticized Black Lives Matter, saying, "It's not our movement," and that, in regard to the George Floyd protests, "most people looting are white; some riots are staged by paid agitators."
Controversy
Jamar garnered controversy after releasing a diss track directed at Kanye West on February 4, 2013, titled "Lift Up Your Skirt," and stated that "gay has no place in hip-hop", which led to him being characterized by some in the media as homophobic. Jamar denied the homophobia accusations by tweeting that he "went to a gay wedding of a good friend not long ago".
In a September 2013 interview on VladTV, Jamar declared that white rappers were "guests in hip hop". Eminem responded to Jamar with the track "Fall" from his 2018 album Kamikaze. Jamar responded to Eminem on his podcast.
In July 2020, Jamar denounced the Black Lives Matter movement in a video posted to his Twitter account by the music account SCUM, saying, "Black Lives Matter is a movement that was given to us by George Soros and his fucking boys because they saw how things were going and they didn't want it to go back to the 60s."
In December 2020, Jamar denied the death of six million Jews in the Holocaust, stating that at most 500,000 died, and claiming that six million Jews were not even present in Europe at the time.
Discography
Studio albums
The 5% Album (2006)
Guest appearances
Filmography
Film
Television
Documentary
References
External links
1968 births
African-American male actors
African-American male rappers
American male rappers
African-American record producers
American hip hop record producers
American Holocaust deniers
American people of Guyanese descent
Critics of Black Lives Matter
Place of birth missing (living people)
American male television actors
Living people
Five percenters
Musicians from New Rochelle, New York
Rappers from New York (state)
Indie rappers
21st-century American rappers
Record producers from New York (state)
21st-century American male musicians
21st-century African-American musicians
20th-century African-American people
American people of Jamaican descent |
Arvid Andersen (1909 – 31 October 1970) was a Danish violinist, conductor, and composer. He was the son of the writer Olaf Andersen, and composed, among other things, a concerto for his own instrument and a Capriccio for piano.
Male composers
Danish conductors (music)
Male conductors (music)
Danish classical violinists
Male classical violinists
1909 births
1970 deaths
20th-century classical violinists
20th-century Danish composers
20th-century conductors (music)
20th-century Danish male musicians |
Quizmania is an Australian phone-in quiz show, based on the British program of the same name, and broadcast on the Nine Network in the late night time slot (post-midnight). The show was produced from Nine's Richmond studios in Melbourne. Its main Director was Rick Maslan.
Quizmania was first broadcast live on Nine Network stations GTV, TCN, QTQ, and NTD, and affiliates NBN and WIN Television on 25 July 2006. The show was unique in that it was broadcast live to South Australia, Western Australia, and Northern Territory with the presenters welcoming SA and NT to the show half an hour after it started, due to those states being thirty minutes behind the Australian east coast, and welcoming WA 2 hours after commencement. Similarly during daylight saving months, Queensland viewers were welcomed an hour later when the broadcast began in that state.
Sometimes due to varying program schedules in each capital city or regional area, some cities and/or areas did not broadcast Quizmania while other cities and/or areas still received the broadcast.
Only contestants aged 18 or over were allowed to participate. Underage callers were a regular occurrence on the show especially during school holidays.
Programme history
When it first aired on Tuesday 25 July 2006, Quizmania was to soon run in direct competition with the established The Up-Late Game Show on Channel Ten, returning a week later on Monday 31 July, after the 2006 Big Brother series had ended with its UpLate late-night show finished. A few days after, Seven Network introduced a similar phone-in quiz show, Midnight Zoo. Both competing programmes soon ceased broadcasting – Midnight Zoo only lasted three months. Quizmania remained on air for the longest period.
During the 2007 Big Brother series, Quizmania faced competition with the return of the UpLate program (see Notable dates).
Hosts
Quizmania originally started out with three hosts, Nikki Osborne, Amy Parks and Brodie Young. In early January 2007, Katrina Conder and Suze Raymond were added to the lineup. On 12 May 2007, Nikki Osborne hosted her last Quizmania show after she announced a few days earlier that she was leaving to work on the new Channel Nine show The Nation with Mick Molloy.
Amy now works as a news reporter on Seven News Melbourne.
Two hosts appeared on weekday episodes. On Fridays and Saturdays there were three hosts due to the four-hour running time.
Games
Some of the games played on Quizmania include:
Tower game
This game was created by Quizmania in Britain. It consisted of seven blank spaces increasing in value, ranging from anywhere up to $500. At the top of the tower was either be a phrase with a missing word or a topic to guess. For example, one game could be HOT _, viewers could call in and guess hot weather, hot water, hot pants, etc. Alternatively, the game could be "Boys Names Beginning With T" and viewers could call and guess Trevor, Timothy, Thierry, etc.
Games of this type came under particular criticism because they appeared specifically designed so as not to have any solid 'right or wrong' type answers. For example, the viewers might simply be asked to "name a rock band", while a graphic will appear on screen with 10 spaces to represent the 10 bands that need to be named. The problem with this is that there is no way to verify in advance what bands were actually on the list – it was down to the discretion of the Quizmania team to declare which bands are and are not on the list.
Word Search game
Viewers were to find a certain type of word in a grid. Words were written horizontally, vertically, diagonally or also back-to-front.
Words found in the grid normally won the player $50.
Beat the Break
Before January 2007, a game took place during the ad-breaks, where they gave the viewers a multiple choice question with two silly answers and the correct answer. Viewers then had to call in during the ad-breaks and, if they gave the correct answer, won $50.
The Quizmania Gold Mine
This game was first introduced on 4 April 2007 and had two parts to it. The first part is where a viewer calls up and correctly answers a dingbat, a graphic on the screen which features a picture of two different objects (for example, a car and a set of keys). The viewer had to say the correct answer (car keys) to receive $50. Then the viewer got to pick from a wall of 15 gold cards pinned to it numbered from 1 to 15. Some had no prizes behind them, others had Savvytel starter kits (mobile phone credit) or minor cash prizes but only one has the "Gold Mine" which jackpots after each unsuccessful caller until someone picked the numbered card with the "Gold Mine" on it. After that, a tower game was played for the remainder of the episode.
Incentives
Periodically, an incentive to call in was displayed on the screen. One or more incentives may have been offered at any one time. These included:
A bonus offer, when the next caller or callers would be offered a certain amount of extra cash if they say a correct answer.
A "speed round", where many calls are taken with reduced banter.
Caller countdown clocks, where a countdown timer was placed on the screen and the host mentioning that a call would be taken any time from now until the clock hits zero (the length of the countdown clock varied from three minutes to fifteen seconds).
Double, triple or quadruple the normal amount of money on offer.
A second guess, where if the first answer mentioned by a caller was wrong, they got to say another answer (this offer was very rare).
A caller or callers will receive $50 just for getting through to the studio even if they got the answer wrong (this offer was very rare).
The possibility of receiving a Savvytel mobile phone starter kit with $20 credit (usually given away at random if the producers like the answer given but is not an answer in the current game).
Notable dates
Technical problems
On a number of occasions, Quizmania'''s phone system – ran by Legion Interactive – broke down due to overwhelming numbers of calls, human error, power outages and numerous other causes. Most of the time, the problem was fixed within 5–10 minutes and the show resumed where it dropped off from. There have also been a couple of serious technical problems which have forced Quizmania to cease for the night and be replaced with other programming.
Severe technical problems
On 3 August 2006, the show experienced severe technical problems resulting in the current quiz being postponed several times, and presenters Nikki Osborne and Amy Parks ad-libbed for the duration of the breakdown. The show was delayed and alternative programming (two episodes of The Drew Carey Show) was shown instead.
On 11 January 2007, the show experienced severe technical problems again, resulting in the quiz being postponed several times. Again, Nikki Osborne and the production crew ad-libbed through the breakdown, reminding viewers to not call until the problem was fixed. At one stage when the problem appeared to have been fixed and the competition resumed, one woman who called through and gave a correct answer was disconnected before she could give her details to producers. This required Osborne to tell her, on the air, to ring the Quizmania office at Channel Nine the next day to receive her $500 winnings. The show was suspended again, and alternative programming was eventually shown at approximately 1.30 am with Eve followed by The Avengers.
Axing
The show's contract with the Nine Network was not renewed, and the announcement to staff of the end of production was made on 31 May 2007. The 207th and final show was broadcast live on 24 June 2007. Quizmania was replaced by The Mint on 31 July, another quiz show once again taking its title from a UK quiz show of the same name. It was produced solely by the Nine Network, discontinuing the association with Fremantle Media.
See also
The Up-Late Game Show Midnight Zoo''
References
External links
Official Quizmania MySpace page
Quizmania Fansite
2006 Australian television series debuts
2007 Australian television series endings
2000s Australian game shows
English-language television shows
Nine Network original programming
Phone-in quiz shows
Television shows set in Melbourne
Television series by Fremantle (company) |
New Hope Township is a non-functioning administrative division of Iredell County, North Carolina, United States. By the requirements of the North Carolina Constitution of 1868, the counties were divided into townships, which included New Hope township as one of sixteen townships in Iredell County.
Geography
New Hope township contains the town of Love Valley (population of 90 in 2010).
References
Townships in Iredell County, North Carolina
Townships in North Carolina
1868 establishments in North Carolina |
```java
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
package jdk.graal.compiler.jtt.except;
import org.junit.Test;
import jdk.graal.compiler.jtt.JTTTest;
public class BC_athrow0 extends JTTTest {
static Throwable throwable = new Throwable();
public static int test(int arg) throws Throwable {
if (arg == 2) {
throw throwable;
}
return arg;
}
@Test
public void run0() throws Throwable {
runTest("test", 0);
}
@Test
public void run1() throws Throwable {
runTest("test", 2);
}
}
``` |
William Chi-Cheng Chen is a Grandmaster of Yang-style tai chi who currently lives in the US. His school is in New York City and he has hundreds of students around the world.
He was born in 1933 in Wenzhou, Zhejiang province, China. A US Passport error has his year of birth as 1935. After his family moved to Taiwan, he began studying tai chi under the tutelage of Prof. Cheng Man-ch'ing who was a childhood friend of William C. C. Chen's father.
His skill, aptitude and language skills helped him become one of Prof. Cheng Man-ch'ing's favorite disciples. Not only was he an extraordinary student but he also helped as his teachers' translator. Through this he acquired a lot of knowledge from his teacher and insight from fellow students.
Tai chi lineage tree with Yang-style focus
Notes
References
Chen, William C.C.,An Autobiography of William C.C. Chen, http://www.williamccchen.com/biograph.htm April 2010
Robinson, Ronnie, Grandmaster William C.C. Chen Interview, http://www.taichiunion.com/magazine/wccc.html
Living people
1935 births
American tai chi practitioners |
```java
/*
This file is part of the iText (R) project.
Authors: Apryse Software.
This program is offered under a commercial and under the AGPL license.
For commercial licensing, contact us at path_to_url For AGPL licensing, see below.
AGPL licensing:
This program is free software: you can redistribute it and/or modify
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
along with this program. If not, see <path_to_url
*/
package com.itextpdf.io.font.constants;
public final class FontWeights {
private FontWeights() {
}
// Font weight Thin
public static final int THIN = 100;
// Font weight Extra-light (Ultra-light)
public static final int EXTRA_LIGHT = 200;
// Font weight Light
public static final int LIGHT = 300;
// Font weight Normal
public static final int NORMAL = 400;
// Font weight Medium
public static final int MEDIUM = 500;
// Font weight Semi-bold
public static final int SEMI_BOLD = 600;
// Font weight Bold
public static final int BOLD = 700;
// Font weight Extra-bold (Ultra-bold)
public static final int EXTRA_BOLD = 800;
// Font weight Black (Heavy)
public static final int BLACK = 900;
public static int fromType1FontWeight(String weight) {
int fontWeight = NORMAL;
switch (weight.toLowerCase()) {
case "ultralight":
fontWeight = THIN;
break;
case "thin":
case "extralight":
fontWeight = EXTRA_LIGHT;
break;
case "light":
fontWeight = LIGHT;
break;
case "book":
case "regular":
case "normal":
fontWeight = NORMAL;
break;
case "medium":
fontWeight = MEDIUM;
break;
case "demibold":
case "semibold":
fontWeight = SEMI_BOLD;
break;
case "bold":
fontWeight = BOLD;
break;
case "extrabold":
case "ultrabold":
fontWeight = EXTRA_BOLD;
break;
case "heavy":
case "black":
case "ultra":
case "ultrablack":
fontWeight = BLACK;
break;
case "fat":
case "extrablack":
fontWeight = BLACK;
break;
}
return fontWeight;
}
public static int normalizeFontWeight(int fontWeight) {
fontWeight = (fontWeight/100)*100;
if (fontWeight < FontWeights.THIN) return FontWeights.THIN;
if (fontWeight > FontWeights.BLACK) return FontWeights.BLACK;
return fontWeight;
}
}
``` |
is a city in Kumamoto Prefecture, Japan.
As of March 31, 2017, the city has an estimated population of 61,022 and a population density of 1,100 persons per km². The total area is 53.19 km².
The modern city of Kōshi was established on February 27, 2006, from the merger of former town of Kōshi, with the town of Nishigoshi (both from Kikuchi District). It was the 14th "Great Heisei Merger" in Kumamoto Prefecture.
Notable people
Yudai Nakashima (1984–), football player
Masato Uchishiba (1978–), Olympic judo wrestler
Kyosuke Usuta (1974–), manga artist
References
External links
Cities in Kumamoto Prefecture |
Saint-Georges (; ; Lorrain: Saint Jouonh) is a commune in the Moselle department in Grand Est in north-eastern France.
See also
Communes of the Moselle department
References
External links
Saintgeorges |
Achrotelium is a genus of rust fungi in the Chaconiaceae family. The genus contains five species that are found in the USA, Philippines, India, and Zimbabwe.
References
External links
Pucciniales |
Jules Piccard, also known as Julius Piccard (20 September 1840, in Lausanne – 11 April 1933, in Lausanne) was a Swiss chemist. He was the father of twins Auguste Piccard (1884–1962) and Jean Felix Piccard (1884–1963), both renowned balloonists.
He studied chemistry at the University of Heidelberg as a student of Robert Bunsen, receiving his doctorate in 1862. Shortly afterwards, he obtained his habilitation at the polytechnical institute in Zürich. From 1869 to 1903 he was a professor of chemistry at the University of Basel.
He made contributions in the field of food chemistry and in his research of cantharidin, dinitrocresol, chrysin and resorcinol. He is also known for his studies involving the atomic weight of rubidium.
Selected writings
De l'évaluation mécanique des surfaces planes, (with S.Cuénoud 1861) – On the mechanical evaluation of plane surfaces.
Beiträge zur Kenntniss der Rubidiumverbindungen, 1862 – Contributions regarding rubidium compounds.
L'avenir de l'agriculture d'après M. de Liebig : compte-rendu de l'introduction à la septième éd. de son ouvrage sur la Chimie agricole, 1862 – The future of agriculture in regards to Justus von Liebig.
Chemisch-geognostische Mittheilungen, 1866 – Chemical-geognostic reports.
Bernoullianum : Anstalt für Physik, Chemie und Astronomie an der Universität Basel : Beschreibung und Pläne (with Eduard Hagenbach-Bischoff and Johann Jacob Stehlin, 1876) – Bernoullianum Institute of Physics, Chemistry and Astronomy at the University of Basel.
Produits chimiques et pharmaceutiques : rapport, 1879 – Chemical and pharmaceutical products.
Rapport supplémentaire sur la question des brevets d'invention appliqués aux industries chimiques, 1881 – Supplementary report on the question of patents for the chemical industry.
Louis Rütimeyer, 1897 – Biography of Ludwig Rütimeyer.
References
1840 births
1933 deaths
Scientists from Lausanne
Heidelberg University alumni
Academic staff of the University of Basel
Swiss chemists |
The 15th Regiment of the Illinois Volunteer Cavalry was a volunteer cavalry regiment that served in the Union Army during the American Civil War.
History of service
The 15th Illinois Cavalry was organized at Aurora, Kane Co., Illinois on 2 Aug 1861 by Captain Albert Jenkins and was mustered on 23 September 1861 as Cavalry, attached to the Thirty-Sixth Illinois Volunteers.
On 24 September 1861, moved from camp, and reported to the Regiment, at Rolla, Missouri. On 31 December 1861, reported to Colonel Carr, commanding Third Illinois Cavalry, and moved to Bennett's Mills.
On 10 February 1862, moved to Osage Springs, Missouri., arriving on 20th. On 2 March 1862, moved, with Siegel's Division, to near Bentonville, losing 4 men taken prisoners. Was engaged, 7 and 8 March, at Pea Ridge. Moved, with the army, to Salem. On 1 May 1862, ordered to White River. Returned to Batesville, on the 9th. Was engaged in the movements of Asboth's Division, and arrived at Cape Girardeau, Missouri., 24 May 1862. Moved to Hamburg Landing, Tennessee. Was escort for General Rosecrans, at Battle of Corinth, 3 and 4 October. 25 December 1862, was assigned to the Fifteenth Illinois Cavalry.
On 9 June 1863, moved to Memphis. 20 May 1863, landed at Chickasaw Bayou, and was engaged in the operations against Vicksburg, with the Regiment. On 17 August 1862, moved to Carrollton, Louisiana. On 5 September 1862, moved, with Fourth Division, Thirteenth Army Corps, to Morganza, Louisiana and was engaged in the campaign, General Herron commanding. On 10 October 1863, returned to Carrollton. 15th, moved to Brashear, Louisiana., and, on 17th, to New Iberia, Louisiana.
Was engaged in scouting, and various expeditions, reporting to Brigadier General A. L. Lee, as escort, 5 January 1864. On 11 February 1864, the company moved for Illinois, for veteran furlough, and, on 26th, the men were furloughed at Chicago, Illinois.
The non-veteran members of the regiment mustered out on 31 July 1865 and the recruits and veterans were transferred to the 10th Regiment Illinois Volunteer Cavalry.
Battles and campaigns
During their three years of service, the 15th Illinois Volunteer Cavalry Regiment saw action in Tennessee, Alabama, and Mississippi.
A list of battle and campaigns they were engaged in include: Sherman's March to the Sea, Siege of Vicksburg, Siege of Corinth, Siege of Belmont, Battle of Chickamauga, Battle of Shiloh, Battle of Fort Henry and Fort Donelson, Battle of Resaca, Battle of Kenesaw Mountain, Battle of Perryville, Battle of Stones River, Tullahoma Campaign, Atlanta Campaign, Campaign of the Carolinas, Central Mississippi Campaign, New Madrid and Island #10 Campaign, and the Chattanooga Campaign.
Total strength and casualties
The regiment suffered 2 officers and 12 enlisted men who were killed in action or who died of their wounds and 1 officer and 122 enlisted men who died of disease, for a total of 137 fatalities.
Regimental officers
Colonel Warren Stewart – killed in action near Vicksburg, Mississippi on 23 January 1863.
Lieutenant Colonel George A. Bacon – mustered out with the regiment.
Major James G. Wilson – transferred to the 4th U.S.C.T. Cavalry
Captain William Ford – Company A Cavalry (known as Stewart's Independent Battalion Cavalry)
Captain Egleton Carmichael – Company B (known as Carmichael's Cavalry Company)
Captain James J. Dollins – Company C (known as Dollins' Cavalry Company)
Captain Morrison J. O'Harnett – Company D (known as O'Harnett's Cavalry Company)
Captain William D. Hutchens – Company E (known as Hutchen's Cavalry Company)
Captain Joseph Adams – Company F
Captain Franklin T. Gilbert – Company G (known as Gilbert's Cavalry Company)
Captain William C. Wilder – Company H (known as Wilder's Cavalry Company)
Captain Albert Jenks – Company I (known as Jenks Cavalry Dragoons)
Captain Samuel B. Sherer – Company K (known as Sherer's Cavalry Company Dragoons)
Captain William Ford – Company L (known as Ford's Cavalry Company)
Captain Oscar H. Huntley – Company M
Henry Wilcox – Quartermaster
Reverend Simeon Walker – Chaplain
Dr. Josiah H Skilling – Surgeon
Dr. David N. Moore – Surgeon
Dr. Ezra M. Miller – Veterinary Surgeon
See also
List of Illinois Civil War Units
Illinois in the American Civil War
Notes
References
The Civil War Archive
The Illinois State Archives: The Illinois Civil War Muster and Descriptive Rolls Database,'' Illinois Adjutant General's Report, Regimental and Unit Histories Containing Reports for the Years 1861–1866 http://www.cyberdriveillinois.com/departments/archives/datcivil.html#reghistory
Units and formations of the Union Army from Illinois
1862 establishments in Illinois
Military units and formations established in 1862
Military units and formations disestablished in 1865 |
Manido Falls is a waterfall on the Presque Isle River and is located in the Porcupine Mountains Wilderness State Park in Gogebic County, Michigan. With a drop of approximately 15 feet, it is the smallest of the waterfalls on the river. It has a crest between 50 and 150 feet, depending on the river volume. It is above Manabezho Falls and further down from Nawadaha Falls. The name Manido comes from the Ojibway word meaning “spirit” or “ghost”. A view of the falls is easily accessible by trail.
References
Great Lakes Waterfalls
Protected areas of Gogebic County, Michigan
Waterfalls of Michigan
Landforms of Gogebic County, Michigan |
James Hamilton "Jim" Ottley is a Panamanian bishop in The Episcopal Church.
Life
Ottley was born in Colon, Panama. He received his bachelor's and master's degrees from the Episcopal Theological Seminary of the Caribbean, in Puerto Rico, and was ordained to the priesthood in 1964. He returned to Panama as a priest and on January 21, 1984, was consecrated bishop and was the fifth bishop of the Episcopal Diocese of Panama until 1995.
Bishop Ottley has a master's degree in science with a specialization in clinical psychology. He has three Doctorate Degrees Honoris Causa from the Theological Seminary of the Southwest, Austin, TX, The University of the South and Berkeley Divinity School at Yale. He has co-authored many books and wrote First Time You Say hello! Next Time We Will Be Friends.
He served simultaneously as bishop of the Anglican Diocese of El Salvador from 1985-1992. At the time Ottley was the bishop, Panama was a diocese in Province 9 of the Episcopal Church in the United States of America. Panama is part of the Anglican Church in Central America. He was subsequently appointed Anglican Observer at the United Nations by the Anglican Consultative Council and the Archbishop of Canterbury. In 2000, he became interim bishop of the Diocese of Honduras, serving until the consecration of Lloyd Allen. He also served as Interim Bishop of the Diocese of Cuernavaca of the Anglican Church of Mexico.
Until the end of May 2007, Ottley was the assistant bishop of the Episcopal Diocese of Southeast Florida. In June of that year he became the assistant bishop of Long Island. He has a wife and 4 children and 8 grandchildren.
References
1939 births
Living people
Anglican bishops of El Salvador
Anglican bishops of Cuernavaca
Episcopal bishops of Honduras
Anglican bishops of Panama
Episcopal bishops of Southeast Florida
Episcopal bishops of Long Island
Panamanian Anglicans
People from Colón, Panama |
is an action-adventure video game developed by Omega Force and published by Koei for the PlayStation. Set in 1920, the game features three playable characters from England, Japan, and America, who travel the world solving puzzles in various ruins and temples. The game was never released outside of Japan.
Gameplay
Enigma is a single player adventure game with three selectable characters.
Development and release
The game was developed by Omega Force, who had previously developed Dynasty Warriors. During this period, Koei was attempting to branch out from the strategy game genre that they were known for. They produced several games such as the shooting game Winback, the fighting game Dynasty Warriors, as well as Enigma, an adventure game. The game was directed by Kazuta Imamura, while Tatsuya Yazaki served as the producer, and Kageki Shimodo wrote the story. When the game was announced in June 1997 at E3, development was expected to take 9 months, and there was initial plans to localize the game for English markets. At the time, a PlayStation version was confirmed, but there were also the possibility of versions for the Nintendo 64, or Personal Computer as well. A spokesperson for Koei at the time described the game as like "Indiana Jones but with a twist of Resident Evil". The spokesperson also said it was possible that the game could outsell the recently released game Final Fantasy 7.
The game was later shown at the Tokyo Game Show Spring 1998. It was part of over 200 PlayStation games shown at the show, compared to just 16 for the Nintendo 64.
Enigma was released on April 2, 1998 for the Sony PlayStation in Japan and was published by Koei. A 127-page guidebook was published by Koei titled Enigma Hyper Guidebook.
The game has never been released outside of Japan, nor has it been released on the PlayStation's Game Archives in Japan either.
Reception
Famitsu gave it a score of 25 out of 40. A reviewer noted that the viewpoint and control scheme is very similar to Resident Evil.
Brazilian magazine Super GamePower gave it a score of 3.8/5.
Joypad gave it a 5/10.
Brazilian magazine Acao Games gave it 9.10, praising the graphics, gameplay, and challenge.
Notes
References
External links
1998 video games
Japan-exclusive video games
PlayStation (console) games
PlayStation (console)-only games
Single-player video games
Koei games
Video games developed in Japan
Omega Force games
Action-adventure games |
Gastão José Ministro Elias (; born 24 November 1990) is a Portuguese professional tennis player, who competes on the ATP Tour. He became the fifth Portuguese tennis player to break into the top 100 of the Association of Tennis Professionals singles rankings. In October 2016, he reached a career-high singles ranking of world No. 57 to become the second-highest-ranked Portuguese player, after João Sousa (No. 28).
Early and personal life
Gastão Elias was born on 24 November 1990 in Caldas da Rainha, Portugal. At age four, he started playing tennis with his father. In 2001, he participated in the national under-12 singles competition, falling to future Davis Cup partner João Sousa in the semifinals. Elias idolized James Blake and Roger Federer while growing up. He is a supporter of Sporting Clube de Portugal, Real Madrid C.F. and Liverpool F.C.
Career
Professional career
2016 proved to be a breakthrough year for Elias. After winning an ATP Challenger Tour tournament in Turin by defeating Enrique López Pérez in three sets and earning position in the top 100, being ranked no. 94, Elias continued capitalizing on his Challenger Tour success as he won his sixth Challenger title in Mestre, Italy by defeating Horacio Zeballos in straight sets. In July 2016, Elias made his first splash on ATP World Tour tournament level in Båstad, Sweden after defeating Christian Lindell, Taro Daniel, and pulling an upset against compatriot João Sousa on his way to his first ATP World Tour semifinal. However, in the semifinals, Elias lost to Fernando Verdasco. Later in July 2016, Elias participated in another ATP World Tour tournament in Umag, Croatia. Elias defeated Guillermo García López in the round of 32 and then pulled one of the biggest upsets of the tournament by defeating top seeded Pablo Cuevas in a close encounter. That win marked Elias' first win over a top-20 player. Elias then defeated Pablo Carreño Busta and reached his second consecutive ATP World Tour semifinal, where he lost to Fabio Fognini in straight sets.
Playing style
Gastão Elias is offensive baseliner who puts focus on hitting hard and accurate groundstrokes to push his opponents and hitting winners, however also making comparable to winners amount of unforced errors. His serve and forehand shot are dangerous weapons, which are the main instruments in winning points, but return game is one of the weaknesses, which can be exploited by the best players whose game heavily based on strong serve and volley tactic. While feeling most comfortable at the baseline Elias makes occasional runs to the net, though these runs can't be classified as the key aspect of his game. Although his favourite surface is hard, most of his success came on clay.
Challenger and Futures/World Tennis Tour finals
Singles: 34 (16–18)
Doubles: 6 (2 titles, 4 runners-up)
Performance timelines
Singles
Current through the 2022 Davis Cup.
1Held as Hamburg Masters (outdoor clay) until 2008, Madrid Masters (outdoor clay) 2009–present.
Doubles
Wins over top 10 players
Singles
Elias has a 1–1 win–loss career record against ATP top 10-ranked players.
Head-to-head against top 20 players
This section contains Elias's win–loss record against players who have been ranked 20th or higher in the world rankings during their careers.
Career earnings
* As of 10 April 2017
National participation
Davis Cup (13 wins, 17 losses)
Elias debuted for the Portugal Davis Cup team in 2007 and has played 30 matches in 16 ties. His singles record is 6–8 and his doubles record is 7–9 (13–17 overall).
indicates the result of the Davis Cup match followed by the score, date, place of event, the zonal classification and its phase, and the court surface.
References
External links
1990 births
Living people
People from Caldas da Rainha
Sportspeople from Bradenton, Florida
Portuguese expatriates in the United States
Portuguese male tennis players
Tennis people from Florida
Tennis players at the 2016 Summer Olympics
Olympic tennis players for Portugal
21st-century Portuguese people |
In particle physics, G-parity is a multiplicative quantum number that results from the generalization of C-parity to multiplets of particles.
C-parity applies only to neutral systems; in the pion triplet, only π0 has C-parity. On the other hand, strong interaction does not see electrical charge, so it cannot distinguish amongst π+, π0 and π−. We can generalize the C-parity so it applies to all charge states of a given multiplet:
where ηG = ±1 are the eigenvalues of G-parity. The G-parity operator is defined as
where is the C-parity operator, and I2 is the operator associated with the 2nd component of the isospin "vector". G-parity is a combination of charge conjugation and a π rad (180°) rotation around the 2nd axis of isospin space. Given that charge conjugation and isospin are preserved by strong interactions, so is G. Weak and electromagnetic interactions, though, are not invariant under G-parity.
Since G-parity is applied on a whole multiplet, charge conjugation has to see the multiplet as a neutral entity. Thus, only multiplets with an average charge of 0 will be eigenstates of G, that is
(see Q, B, Y).
In general
where ηC is a C-parity eigenvalue, and I is the isospin.
Since no matter whether the system is fermion-antifermion or boson-antiboson, always equals to , we have
.
See also
Quark model
References
Particle physics
Standard Model |
Delta Ophiuchi (δ Ophiuchi, abbreviated Delta Oph, δ Oph), formally named Yed Prior , is a star in the constellation of Ophiuchus. It forms a naked-eye optical double with Epsilon Ophiuchi (named Yed Posterior). The apparent visual magnitude is 2.75, making this a third-magnitude star and the fourth-brightest in the constellation. Parallax measurements from the Hipparcos spacecraft yield a distance estimate of approximately from the Sun (Epsilon Ophiuchi is approximately ).
Nomenclature
δ Ophiuchi (Latinised to Delta Ophiuchi) is the star's Bayer designation.
It bore the traditional name Yed Prior. Yed derives from the Arabic يد yad "hand". Delta and Epsilon Ophiuchi comprise the left hand of Ophiuchus (the Serpent Bearer) that holds the head of the serpent (Serpens Caput). Delta is Yed Prior as it leads Epsilon across the sky. In 2016, the International Astronomical Union organized a Working Group on Star Names (WGSN) to catalogue and standardize proper names for stars. The WGSN approved the name Yed Prior for this star on 5 October 2016 and it is now so included in the List of IAU-approved Star Names.
Delta Ophiuchi was a member of the indigenous Arabic asterism al-Nasaq al-Yamānī, the "Southern Line" of al-Nasaqān the "Two Lines", along with Alpha Serpentis, Delta Serpentis, Epsilon Serpentis, Epsilon Ophiuchi, Zeta Ophiuchi and Gamma Ophiuchi.
In Chinese, (), meaning Right Wall of Heavenly Market Enclosure, refers to an asterism which represents eleven ancient states in China and which mark the right borderline of the enclosure, consisting of Delta Ophiuchi, Beta Herculis, Gamma Herculis, Kappa Herculis, Gamma Serpentis, Beta Serpentis, Alpha Serpentis, Delta Serpentis, Epsilon Serpentis, Epsilon Ophiuchi and Zeta Ophiuchi. Consequently, the Chinese name for Delta Ophiuchi itself is (, ), representing the state of Liang (梁) (or Leang).
Properties
Delta Ophiuchi has a stellar classification of M0.5 III, making this a red giant star that has undergone expansion of its outer envelope after exhausting the supply of hydrogen at its core. It is currently on the asymptotic giant branch. The measured angular diameter of this star, after correction for limb darkening, is . At the estimated distance of Delta Ophiuchi, this yields a physical size of about 59 times the radius of the Sun. In spite of its enlarged size, this star has only 1.5 times the mass of the Sun and hence a much lower density. The effective temperature of the outer atmosphere of Delta Ophiuchi is a relatively cool 3,679 K, which is what gives it the orange-red hue of an M-type star.
It is listed as a suspected variable star that may change by 0.03 in visual magnitude. It has a low projected rotational velocity of , which gives a minimum value for the azimuthal velocity along the star's equator. The abundance of elements other than hydrogen and helium, what astronomers term the star's metallicity, is more than double the abundance in the Sun's photosphere.
The star has a high optical linear polarisation that increases from red to blue wavelengths and displays some variability, this has been ascribed to either an asymmetric distribution of dust grains in an envelope expelled from it, or the presence of photometric hot spots.
References
External links
M-type giants
Asymptotic-giant-branch stars
Suspected variables
Ophiuchus
Ophiuchi, Delta
Durchmusterung objects
Ophiuchi, 01
146051
079593
6056
Yed Prior |
Evan Stuart Marshall (born June 5, 1956 in Boston, Massachusetts) is a literary agent, author of murder mysteries and nonfiction books, editor, and publisher of Marshall Plan software.
Life and career
Marshall has held senior editorial positions at Houghton Mifflin, Ariel Books, New American Library, Everest House and Dodd, Mead, where he acquired national and international bestsellers. He was also a correspondent for Writer's Digest and covered commercial fiction. He wrote cover stories on blockbuster and bestselling novels and how to find and work with agents. Marshall's articles have appeared in reference anthologies and collected works. He is often interviewed for his expertise in novel writing, and helping novel writers.
Works
Writings
"Hidden Manhattan" Mystery Series:
City in Shadow, Severn House Publishers, New York, NY, 2010.
Dark Alley, Severn House Publishers, New York, NY, 2009.
Evil Justice, Severn House Publishers, New York, NY, 2009.
Death is Disposable, Severn House Publishers, New York, NY, 2008.
"Jane Stuart and Winky" Mystery Series:
Crushing Crystal, Kensington Books, New York, NY, 2004.
Toasting Tina, Kensington Books, New York, NY, 2003.
Icing Ivy, Kensington Books, New York, NY, 2002.
Stabbing Stephanie, Kensington Books, New York, NY, 2001.
Hanging Hannah, Kensington Books, New York, NY, 2000.
Missing Marlene, Kensington Books, New York, NY, 1999.
The Marshall Plan Book Series
The Marshall Plan for Novel Writing: A 16-Step Program Guaranteed to Take You From Idea to Completed Manuscript, Writer's Digest Books, 1998.
The first book in the series describes novel writing as a 16-step process, taking the novel's intended finished length into account from the beginning. Marshall focuses specifically on fiction, identifying it as the writing genre most likely to be picked up by a publisher. Drawing from Dwight V. Swain and Jack Bickham's techniques, Marshall identifies two core plotting units: the action section and the reaction section. Marshall recommends the number, and the type of action and reaction sections in relation to a novel's length. He also recommends the corresponding story arc with plot points all in a specific order, the number and type of viewpoint characters, the type of opposition, and other elements of plot and character development.
The Marshall Plan Workbook
The second book in the series concentrates on the fundamental details of producing a novel. The first half of the book assists the writer in building characters, developing plot and setting goals. The second half is the Plan Blueprint, a 58-page section of fill-in-the-blank sheets to help writers produce a novel. The marketing information included focuses on the manuscript itself, how it should look, how many pages, paper weight, etc.
The Marshall Plan for Getting Your Novel Published
The third book in the series focuses on how to take the next step of sending work to editors and agents, and promoting a novel.
Reviews
Publishers Weekly review of Hanging Hannah.
Kirkus Reviews' review of Stabbing Stephanie.
Booklist review of Death is Disposable.
Personal life
Marshall was born in Boston, Massachusetts, and raised in Sharon, Massachusetts. He graduated magna cum laude from Boston College. He is married to Martha Jewett, a business book editor, and literary agent who manages The Marshall Plan software. They have two sons.
References
External links
The Evan Marshall Agency website
A conversation with Evan Marshall
1956 births
Living people
Literary agents
20th-century American novelists
21st-century American novelists
American male novelists
20th-century American male writers
21st-century American male writers |
Weiherbach is a river of Baden-Württemberg, Germany. It is a left tributary of the Talbach near Menningen.
See also
List of rivers of Baden-Württemberg
References
Rivers of Baden-Württemberg
Rivers of Germany |
Etruridelphis is an extinct genus of cetacean.
References
Prehistoric toothed whales
Prehistoric cetacean genera
Pliocene mammals of Europe
Fossil taxa described in 2009 |
The Holly Union Depot is a former train station located at 223 South Broad Street in Holly, Michigan. It was listed on the National Register of Historic Places in 2000. It sits at the junction of tracks which are now owned by CSX Transportation and Canadian National Railway.
History
Saw and grist mills were established in what is now Holly in 1843 and 1844, and a village slowly grew up around them. However, real growth only began with the arrival of the Detroit and Milwaukee Railway (later the Detroit, Grand Haven and Milwaukee Railway and now part of the Canadian National Railway) in 1855. The D & M Railway constructed a small wooden depot, and soon replaced it with a better one. In 1864, a second railroad line, the Flint and Holly Railroad (now part of the CSX Saginaw Subdivision), was completed into Holly. The two rail lines co-operated to build a union depot to serve both lines, located at the site of the present depot. This wooden depot burned in 1884.
The two railways created temporary space for passengers in their freight sheds, and in September 1885 contracted with Heitsch and Son of Pontiac to construct a new depot and baggage room. Construction began in October and was complete in February 1886. The depot served passengers on the two lines and their successors until 1964, when the Grand Trunk Western Railroad ceased passenger operations through Holly. It was later used as storage by the railroad, and in 1998 the village of Holly purchased the building. It has since been restored. As of 2018, the depot may be moved to another location.
Description
The Holly Union Depot is a long, single story cross-gable-roof structure made from reddish-orange and yellow-buff brick on a stone foundation. It has broadly overhanging eaves supported by open triangular timber brackets. Gabled projections are on each long side; these once contained separate ticket offices for the two railways. A rectangular carved
stone plaque is set into the facade of each projection, containing the town name, HOLLY, in raised capital letters. The building is eighty-two feet ten inches long and twenty-two feet four inches wide.
References
External links
Holly Union Depot at MichMarkers.com
Holly Union Depot at MichiganRailroads.com
National Register of Historic Places in Oakland County, Michigan
Victorian architecture in Michigan
Buildings and structures completed in 1886 |
Tonje Larsen (born 26 January 1975) is a retired Norwegian handballer who played for the Norwegian national team. She is Olympic champion, World champion and three times European champion. As a club player she is several times Norwegian champion and once Danish champion, and has won the EHF Cup, EHF Cup Winners' Cup and the EHF Champions League.
Personal life
Larsen was born in Tønsberg on 26 January 1975.
International championships
Larsen made her debut with the national team in June 1992 against Denmark, seventeen years old, when Sven-Tore Jacobsen was head coach. Her first major tournament came when Marit Breivik selected her for the 1994 European Championship in Germany, where she won a bronze medal. She continued playing for the national team and received medals in the three major competitions for women's handball: gold in the 1998 European Championship, gold in the 1999 World Championship and bronze at the 2000 Summer Olympics in Sydney.
Due to jumper's knee, she was out of the team in 2001 and between 2003 and 2008. She continued playing for Larvik mostly on defense, as her knees could not tolerate the heavier stress of the offensive game. Her career seemed to be in danger, and she considered retiring. Finally, she underwent surgery successfully in 2006. As a side effect of the years she spent injured, Larsen is now considered to be an excellent defense player.
She made her comeback to the national team in 2008, winning a gold medal both at the Summer Olympics in Beijing and at the European Championship held in December in the Republic of Macedonia, where she also made the official All-Star Team as the Best left back of the championship.
As of January 2009, she has played more than 200 matches for the national team, and scored more than 500 goals.
Club career
Larsen started playing handball for her hometown club Tønsberg Turn. She was recruited to Larvik HK when Marit Breivik coached the club, and has later played for Larvik, except one year with the Danish club Viborg HK, in the 1998/1999 season. With Viborg she won the Danish championship as well as the Women's EHF Cup.
With Larvik HK she won the EHF Cup Winners' Cup in 2004/2005, and again in 2007/2008. She reached the semi-final of the Women's EHF Champions League in 2002 and in 2004, and reached the final at the Women's EHF Cup in 1996. She won the Norwegian national championship title with Larvik HK in 1996, 1998, 2000, 2003, 2004, 2005, 2006 and 2007. She has won the Norwegian top League with Larvik ten times, in 1994, 1997, 2000, 2001, 2002, 2003, 2005, 2006, 2007 and 2008.
Awards
Player of the year 2002 in the Norwegian League
Player of the year 2003 in the Norwegian League
Selected into the All-star-team as Best left back at the 2008 European championship
References
1975 births
Living people
Norwegian female handball players
Handball players at the 1996 Summer Olympics
Handball players at the 2000 Summer Olympics
Handball players at the 2008 Summer Olympics
Olympic handball players for Norway
Olympic gold medalists for Norway
Olympic bronze medalists for Norway
Sportspeople from Tønsberg
Viborg HK players
Olympic medalists in handball
Medalists at the 2008 Summer Olympics
Medalists at the 2000 Summer Olympics |
Thakurdwara is a town in Moradabad district in the indian state of Uttar Pradesh.
Location
Thakurdwara is 15 km from Kashipur. The township has been very large part of erstwhile UP and now a thriving in the north of Uttar Pradesh.
Geography
Thakurdwara is located at . The city is situated on Ramnagar-Kashipur-Moradabad Road. Thakurdwara is at just 12 km distance from Kashipur, 48 km distance from its District Main City Moradabad, 218 km distance from National Capital New Delhi and 411 km distance from Awadh Capital Lucknow.
Tourism
The world famous Jim Corbett National Park is just 52 km away from it. The Ramganga Dam(Kalagarh Dam) is 46 km away.
Infrastructure and Transport
The town's nearest Railway Station is Kashipur, Uttarakhand (12 km). The nearest International Airport is Indira Gandhi International Airport, New Delhi, 218 km away. Another near Airport is 72 km away at Pantnagar. But the airport has only single flight on Fri, Sat, Sun, Wed for New Delhi operated by Alliance Air (India).
Demographics
India census, Thakurdwara had a population of 4875. Males constitute 52% of the population and females 48%. Thakurdwara has an average literacy rate of 78%, higher than the national average of 85%: male literacy is 89%, and female literacy is 80%. In Thakurdwara, 11% of the population is under 6 years of age .
Industry
Major sources of income of Thakurdwara are -
Agriculture,
Handloom.
Pasupati Acrylon Limited is spread over an area of approximately 90 acres. Pasupati Acrylon has a manufacturing capacity of 42000 MT/Annum of Acrylic fibre. Pasupati Acrylon supplies its Acrylic fiber under the brand name ‘ACRYLON'.
References
Cities and towns in Moradabad district |
The 81st (West African) Division was formed under British control during the Second World War. It took part in the Burma Campaign.
History
The inspiration for the division's formation came from General George Giffard, commander of the British Army's West Africa Command, who subsequently commanded India Command's Eastern Army, facing the Japanese army on the frontier between India and Burma. Giffard had wide experience with African troops, and was eager for them to participate in the war.
The framework around which the division was formed was the Royal West African Frontier Force. One of the brigades (the 3rd West African) and several of the supporting units which formed the division had already seen action with the 11th (African) Division, against the Italians in East Africa.
The division was established as the 1st (West African) Division on 1 March 1943. Three days later it was renamed the 81st (West African) Division, taking the next vacant number in the list of British infantry divisions. The division's badge was a spider, in black on a yellow circular background. This spider was a reference to Ananse, a cunning character in Ashanti mythology, and drawn so that when a soldier raised his weapon to fire, the spider would appear to be going forwards.
The division arrived in India on 14 August 1943. The movement of the 5th (West African) Brigade was delayed, however, after the troopship which was to carry it was lost in the German attack on Convoy Faith off Portugal on the night of 11/12 July 1943. The 3rd (West African) Brigade was detached to the Chindits, and was intended to garrison jungle bases for the raiding columns. The remainder of the division took part in the second Arakan campaign from February to May, 1944, operating in the Kaladan Valley on the flank of Indian XV Corps.
In late March, substantial Japanese reinforcements (with some troops from the Indian National Army) outflanked the division and forced it to retreat over a range of hills out of the Kaladan valley into that of the Kalapanzin.
In August, the division re-entered the Kaladan valley, forcing the Japanese and Indian National Army to abandon Mowdok, a few miles east of the Indian / Burmese frontier. The division then advanced down the valley once again, reaching Myohaung near the mouth of the river on 28 January 1945.
The division was withdrawn to India to rest on 22 April 1945. On 31 August, it was returned to West Africa and disbanded.
Character and organisation
The division was originally intended to operate on a pack basis, with porters carrying all equipment and supplies. Lieutenant General William Slim, then commanding XV Corps, commented on first inspecting units of the division in late 1943:
Their discipline and smartness were impressive, and they were more obviously at home in the jungle than any troops I had yet seen... I was at once struck by two things. First, by the horde of unarmed porters who were needed to carry supplies, ammunition, baggage and the heavier weapons, and secondly by the large number of white men in a unit, fifty or sixty to a battalion. Accustomed as I was to Indian battalions in the field with usually only seven or eight Europeans, it struck me as an unnecessarily generous supply.
Order of Battle
General Officers Commanding
Major General C G Woolner, from 3 March 1943
Major General Frederick Joseph Loftus-Tottenham, from 3 August 1943 to 31 August 1945
except for
15 to 26 August 1944, Brigadier E Collins
31 January to 2 March 1945, Brigadier A Crook
Formation and North Arakan
From formation to reorganisation during September 1944.
Infantry
3rd (West African) Infantry Brigade Group
Detached to Special Force on 8 November 1943
6th Battalion, Nigeria Regiment
7th Battalion, Nigeria Regiment
12th Battalion, Nigeria Regiment
1st (West African) Auxiliary Group (Nigeria Regiment)
3rd (West African) Light Battery, West African Artillery (WAA)(left 14 May 1943)
7th (West African) Field Company, West African Engineers (WAE)
3rd (West African) Field Ambulance, West African Army Medical Corps (WAAMC)
3rd (West African) Infantry Brigade Provost Section
details from West African Army Service Corps (WAASC)
5th (West African) Infantry Brigade Group
Reorganised as an infantry brigade on 31 August 1944.
5th Battalion, Gold Coast Regiment
7th Battalion, Gold Coast Regiment
8th Battalion, Gold Coast Regiment
3rd (West African) Auxiliary Group (Gold Coast Regiment)
5th Light Battery, (WAA) (left 24 May 1944)
2x Troops 3.7 inch mountain guns
1 Troop 4 x 3 inch Mortars
3rd Field Company, (WAE)
4th Survey Section
4th (West African) Field Butchery, (WAASC)
5th (West African) Field Ambulance,(WAAMC)
5th (West African) Field Hygiene Section, (WAAMC)
5th (West African) Infantry Brigade Provost Section
6th (West African) Infantry Brigade Group
Reorganised as an infantry brigade on 31 August 1944.
1st Battalion, Gambia Regiment
1st Battalion, Sierra Leone Regiment
4th Battalion, Nigeria Regiment
4th (West African) Auxiliary Group (Sierra Leone Regiment)
3rd Light Battery, (WAA) (left 24 May 1944)
2x Troops 3.7 inch mountain guns
1 Troop 4 x 3 inch Mortars
6th Field Company, (WAE)
3rd Survey Section
6th (West African) Brigade Group Company, (WAASC)
8th (West African) Field Butchery,(WAASC)
6th (West African) Field Ambulance, (WAAMC)
6th (West African) Field Hygiene Section, (WAAMC)
6th (West African) Infantry Brigade Provost Section
Divisional Troops
Artillery
1st Light Anti-Aircraft/Anti-Tank Regiment, (WAA) (joined 6 May 1943)
101st Light Regiment,(WAA) (formed 24 May 1944, formed from the 3rd, 5th and 6th Light Batteries 3.7 inch guns)
3rd, 5th and 6th Light Batteries
41st Mortar Regiment, (WAA) (formed 24 May 1944, formed from the mortar troops of the 3rd, 5th and 6th Light Batteries, and strengthened)
101st, 102nd, 103rd Mortar Batteries (8 x 3 inch mortars)
Reconnaissance
81st (West African) Division Regiment, West African Armoured Corps (re-rolled on 1 January 1944, left February 1944, for XV Corps)
11th (East African) Division Scouts (from 20 January 1944)
Engineers
3rd Field Company, (WAE)
Bearers
1st (West African) Auxiliary Group (Nigeria Regiment), from 17 January 1944
Service Corps (West African Army Service Corps)
81st (West African) Infantry Division Transport Regiment (WAASC)
81st (West African) Infantry Division Troops Company Composite Platoon (WAASC)
1st (West African) Field Butchery (WAASC)
Division Troops
81st (West African) Divisional Signals
Air Support Liaison Section
26th Motor Ambulance Convoy
5th Platoon, Burma Intelligence Corps
16th Provost Section
6th Field Security Section
Reorganisation and Arakan beaches
On reorganisation to a standard divisional establishment.
Infantry
5th (West African) Infantry Brigade
As a standard infantry brigade from 31 August 1944.
5th Battalion, Gold Coast Regiment
7th Battalion, Gold Coast Regiment
8th Battalion, Gold Coast Regiment
3rd (West African) Auxiliary Group (Gold Coast Regiment)
5th (West African) Field Ambulance, (WAAMC)
1780 Composite Platoon, (WAASC)
1001st Detachment (West African) Mobile Workshops, West African Electrical and Mechanical Engineers (WAEME)
6th (West African) Infantry Brigade
As a standard infantry brigade from 31 August 1944.
1st Battalion, Gambia Regiment
1st Battalion, Sierra Leone Regiment
4th Battalion, Nigeria Regiment
4th (West African) Auxiliary Group (Sierra Leone Regiment)
6th (West African) Field Ambulance, (WAAMC)
1781 Composite Platoon, (WAASC)
1002nd Detachment (West African) Mobile Workshops, (WAEME)
Divisional Troops
Artillery
1st Light Anti-Aircraft/Anti-Tank Regiment, (WAA) (reorganised as an anti-tank regiment on 1 October, renamed 22 October 1944)
21st Anti-Tank Regiment, (WAA) renamed from the 1st Anti-Tank Regiment, (WAA)
101st Light Regiment, (WAA)
3rd, 5th and 6th Light Batteries
41st Mortar Regiment, (WAA)
101st, 102nd, 103rd Mortar Batteries (8 x 3 inch mortars)
Reconnaissance
81st (West African) Reconnaissance Regiment, West African Armoured Corps (organised as infantry)
11th (East African) Division Scouts
Engineers
3rd Field Company, (WAE)
5th Field Company, (WAE)
6th Field Company, (WAE)
8th Field Park Company, (WAE)
Bearers
1st (West African) Auxiliary Group (Nigeria Regiment)
Division Troops
81st (West African) Divisional Signals
See also
Military history of Nigeria during World War II
The Gambia in World War II
82nd (West African) Division
Seth Anthony, first non-European from Africa to gain the King's Commission
Notes
References
Bibliography
External links
Burma Star organisation page
British Military History
British World War II divisions
Infantry divisions of the United Kingdom
Military units and formations established in 1943
Military units and formations of the British Empire in World War II
D
Military history of the Gambia
Military units and formations disestablished in 1945 |
The Touws River () is a river in the Western Cape province of South Africa. It is a tributary of the Groot River, part of the Gourits River basin. A notable resident of the town is Margaret Maritz (born 27 September 1906) who, as of 2022, aged 116, was regarded as one of the oldest people in South Africa.
Name
The name "Touws" originates from a Khoi word for ash, which also referred to the local "Ash-bushes" (Salsola aphylla). It is uncertain whether the name originally referred to the bushes, or to the colour of the river (historically, the Touws river was occasionally known as the "Ash river").
It also gave its name to the town of Touws River, which lies on the upper reaches of this river.
Course
It sources are in the Matroosberg, Hex River Mountains, near the town of De Doorns. In its upper course it is known as the Smalblaar and the .
Flowing in a southeastern direction, it flows past Touws River town, meeting the right bank of the Groot River after briefly turning southwards. Its tributaries include the Brand, Kalee, Brak, Slang and the Kruis; all are minor rivers.
The Touws is part of the Gouritz Water Management Area and falls within the Drainage system J.
Dams
Verkeerdevlei Dam (capacity )
See also
List of rivers of South Africa
List of drainage basins of South Africa
Water Management Areas
References
External links
Bloutoring Farm, Touws River / Montagu area
Rivers of the Western Cape |
In the motorsport discipline of rallying, Group Rally2 is a formula of rally car specification determined by the FIA for use in its international competitions: the World Rally Championship (WRC) and regional championships. National rallying competitions also allow Group Rally2 cars to compete.
There are no subclasses despite the use of the word 'Group' in the name so 'Rally2' may be used alone with the same definition. The group was launched in 2019 with other similarly named groups after the introduction of the Rally Pyramid initiative to reorganise the classes of car and championships in international rallying was approved in June 2018.
The formula for Group Rally2 cars was taken from R5 class of Group R with the defining ruleset being renamed, this meant that any existing R5 car homologated or approved since their introduction in 2013 could continue to be used in Rally2 level competition. R5 cars were first introduced as an intended replacement for the S2000 car.
In years prior to 2019, 'Rally 2' was used to describe the rules and scenario allowing a rally competitor to restart a rally the day following a retirement. This was renamed 're-start after retirement' in FIA regulations from 2019. Rally2 should not be confused with R2 cars of Group R either, which are officially described as 'Rallye 2'.
Definition
Group Rally2 cars are defined in FIA document '2021 Appendix J - Article 261' as Touring Cars or Large Scale Series Production Cars, supercharged Petrol engine, 4-wheel drive. A production touring car with at least 2500 identical units manufactured must be homologated in Group A, with all the components and changes that make it a Group Rally2 car homologated in an extension. The power to weight ratio is 4.2kg/hp.
FIA Competition
Rally2 cars are placed in FIA 'RC2' sporting class alongside Group Rally2-kit, R4, NR4 and S2000 cars.
Cars
See also
Rally Pyramid
Groups Rally
Group R - R5 (rallying)
Group Rally1
Group Rally3
Group Rally4
Group Rally5
References
External links
Rally groups |
```xml
/*
*
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*/
import { BaseEvent, EventQueuer } from '../../base_event';
import { TerminatedStateAccount, terminatedStateSchema } from '../stores/terminated_state';
export class TerminatedStateCreatedEvent extends BaseEvent<TerminatedStateAccount> {
public schema = terminatedStateSchema;
public log(ctx: EventQueuer, chainID: Buffer, data: TerminatedStateAccount): void {
this.add(ctx, data, [chainID]);
}
}
``` |
Zagórze is a village in the administrative district of Gmina Działoszyce, within Pińczów County, Świętokrzyskie Voivodeship, in south-central Poland. It lies approximately north-east of Działoszyce, south-west of Pińczów, and south of the regional capital Kielce.
References
Villages in Pińczów County |
The 1986 season was the Minnesota Vikings' 26th season in the National Football League, and their first with former offensive coordinator Jerry Burns as head coach, following the departure of Bud Grant at the end of the previous season.
The Vikings finished with a 9–7 record and missed the playoffs for the fourth season in a row.
Offseason
1986 Draft
San Diego traded a 1st round selection (14th overall) and 2nd round selection (44th overall) to the Vikings for their 1st round selection (8th overall) and 3rd round selection (66th overall).
Minnesota traded one of their 2nd round selections (40th overall) and LB Robin Sendlein to Miami for WR Anthony Carter.
Minnesota traded two 2nd round selections (44th and 53rd overall) to the Giants for OT Gary Zimmerman.
The Raiders traded their 1985 6th round selection (164th overall) and 1986 2nd round selection (53rd overall) to Minnesota for LB Brad Van Pelt.
Staff
Roster
Preseason
Regular season
Schedule
Game summaries
Week 1: vs Detroit Lions
Week 8: vs Cleveland Browns
Standings
Statistics
Team leaders
League rankings
Awards and records
On August 2, Fran Tarkenton was inducted into the Pro Football Hall of Fame in Canton, Ohio. He was the first player inducted who was primarily a Minnesota Viking during his career.
Tommy Kramer, the NFL passer rating leader, was named NFL Comeback Player of the Year by Pro Football Weekly.
References
External links
Vikings on Pro Football Reference
Vikings on jt-sw.com
Minnesota Vikings seasons
Minnesota
Minnesota Twins |
Main Point-Davidsville is a local service district and designated place in the Canadian province of Newfoundland and Labrador. It consists of the communities of Main Point and Davidsville.
Geography
Main Point-Davidsville is in Newfoundland within Subdivision L of Division No. 8.
Demographics
As a designated place in the 2016 Census of Population conducted by Statistics Canada, Main Point-Davidsville recorded a population of 302 living in 135 of its 157 total private dwellings, a change of from its 2011 population of 323. With a land area of , it had a population density of in 2016.
Government
Main Point-Davidsville is a local service district (LSD) that is governed by a committee responsible for the provision of certain services to the community. The chair of the LSD committee is Jeffrey Simms.
See also
List of communities in Newfoundland and Labrador
List of designated places in Newfoundland and Labrador
List of local service districts in Newfoundland and Labrador
References
Designated places in Newfoundland and Labrador
Local service districts in Newfoundland and Labrador |
Sparky was a British comic published weekly by DC Thomson, that ran from (issue dates) 23 January 1965 to 9 July 1977 when it merged with The Topper after 652 issues. From 1965–1980 the comic published an annual entitled The Sparky Book. It was a DC Thomson comic, originally aimed at a slightly younger audience to The Beano and The Dandy later it was aimed at the same audience. It changed its name to The Sparky Comic in 1973.
List of comic strips
Strips which featured in Sparky at some point during the course of its 12-year run included. All numbers refer to issues of Sparky.
List of Sparky adventure Strips
As well as featuring comic strips Sparky featured adventure strips, though fewer and fewer of these appeared later in the comic's life.
See also
List of DC Thomson Publications
References
Smith, Alan The Sparky File, Comics UK, expanded from article in Crikey!
One of the appendixes of The Sparky File showing a list of strips that were in Sparky. Posted on the ComicsUK forum .
Comics magazines published in the United Kingdom
Defunct British comics
British humour comics
1965 comics debuts
1977 comics endings
Magazines established in 1965
Magazines disestablished in 1977
Weekly magazines published in the United Kingdom |
Gintautas Paluckas (born 19 August 1979) is a Lithuanian politician.
Biography
In 1997 graduated from Panevėžys J. Balčikonis Gymnasium, from 2000 to 2001 he studied English at Charles Dickens College in London. In 2003 he graduated from the Vilnius University Faculty of Mathematics and Informatics, in 2004 from International Business School. Since 2004 studies at VU Faculty of Law.
From 2003 to 2005 he served as the Chief Specialist at Lithuanian Social insurance institution (Sodra). Since 2005 he served as the Assistant to European Parliament member Justas Paleckis. From 2007 to 2009 he was Director of Administration of the Vilnius city municipality.
In 2012 The final and unappealable decision of the Supreme Court of Lithuania found the service guilty of abusing the service in a non-transparent public procurement tender.
Since 2013 Paluckas was Executive Secretary of the Lithuanian Social Democratic Party, Member of the LSDP Council and Board.
From 2015 to 2019 Paluckas served as Deputy Mayor of Vilnius.
He is an author of several articles and political reviews in the national press.
In 2017 Paluckas won leadership election of the Social Democratic Party of Lithuania after defeating then-Minister of Economy Mindaugas Sinkevičius in a run-off. After leadership election, the party decided to leave a ruling coalition via survey of all its members. As a result of a decision, majority of its members of the Seimas left the party to form a new one, Social Democratic Labour Party of Lithuania, and remain in the ruling coalition. Paluckas was reelected as a leader of the party in 2019.
After poor results in the parliamentary elections of 2020, Paluckas faced criticism over his decision to support the Lithuanian Farmers and Greens Union candidates in the second round of elections. Initially, he stated his willingness to take part in the leadership elections of 2021, but after negative assessment in the party's board, Paluckas resigned on January 22, 2021.
References
Social Democratic Party of Lithuania politicians
1979 births
People from Panevėžys
Vilnius University alumni
Vice-mayors of places in Lithuania
Living people |
Rahna is a village in the Punjab province of Pakistan. It is located at 32°53'0N 72°42'0E with an altitude of 516 metres (1696 feet).
References
Villages in Punjab, Pakistan |
Kyosuke Matsuyama (松山恭助, Matsuyama Kyōsuke, born 19 December 1996) is a Japanese fencer. He won one of the bronze medals in the men's foil event at the 2023 World Fencing Championships held in Milan, Italy.
In 2017, he won the silver medal in the men's individual foil event at the Summer Universiade held in Taipei, Taiwan. He also won the gold medal in the men's team foil event.
He won one of the bronze medals in the men's team foil event at the 2018 Asian Games held in Jakarta, Indonesia.
References
External links
Living people
1996 births
Sportspeople from Tokyo
Japanese male foil fencers
Fencers at the 2018 Asian Games
Fencers at the 2022 Asian Games
Medalists at the 2018 Asian Games
Medalists at the 2022 Asian Games
Asian Games bronze medalists for Japan
Asian Games medalists in fencing
Universiade medalists in fencing
FISU World University Games gold medalists for Japan
Universiade silver medalists for Japan
Medalists at the 2017 Summer Universiade
Fencers at the 2020 Summer Olympics
Olympic fencers for Japan
Left-handed fencers
21st-century Japanese people
World Fencing Championships medalists |
Walter Robert Yowarsky (May 10, 1928 – November 30, 2014) was an American football defensive end, offensive lineman, coach, and scout in the National Football League (NFL) for 50 years.
Early years
Yowarsky was born in Cleveland, Ohio to Michael and Anna Yowarsky. He attended and played high school football at Lincoln High School.
He was also a well-known high school baseball player and was drafted by the Cincinnati Reds after high school but decided pursue football instead.
College career
Yowarsky attended and played college football at the University of Kentucky under head coach Bear Bryant. During his tenure, the Kentucky Wildcats won their first league championship in football (1950), and went to two bowl games, winning the Sugar Bowl.
The Wildcats appeared in the 1951 Sugar Bowl against the #1 ranked Oklahoma Sooners. Yowarsky, despite having played less than five minutes of defense all season, took the field as a third defensive tackle in that game, alongside Outland Trophy winner Bob Gain. Yowarsky recovered a fumble at the Oklahoma 22-yard line, leading to Kentucky's first score on the next play. In the third quarter Oklahoma had the ball at the Kentucky three-yard line and Yowarsky tackled Billy Vessels (future Heisman Trophy winner) for a five-yard loss, after which the Sooners were stopped on downs and Kentucky took possession. In the fourth quarter Yowarsky recovered a fumbled punt. Kentucky won the game 13–7, ending the Sooners' 33-game winning streak and Yowarsky was named the game's MVP. Kentucky's victory over the nation's #1 ranked team in the bowl game led to an officially recognized national championship.
Professional career
Yowarsky was selected in third round (29th overall) of the 1951 NFL Draft by the Washington Redskins. He played until midway through the 1952 season when he entered the Air Force. He returned in 1954 and played in 11 games with 10 starts. On January 28, 1955, he was traded to the Detroit Lions, along with Jim Ricca, in exchange for LaVern Torgeson and Jim Hill. However, he only played two games for the Lions, before being released on October 3.
On October 5, 1955, he was claimed off waivers by the New York Giants, where he played until 1957. He was the starting defensive end for the Giants during their 1956 NFL Championship Game win over the Chicago Bears. Yowarsky was then traded to the San Francisco 49ers in 1958, where he finished his career.
Coaching and scouting career
Coaching
After retiring from football, Yowarsky became an assistant coach and scout with the Giants from 1959 to 1960. He then became the offensive line coach for the Minnesota Vikings in head coach Norm Van Brocklin in 1961 (their inaugural season in the NFL) through 1966.
In 1967, he left the Vikings organization to become offensive line coach for the New Orleans Saints, who were also playing their inaugural season in the NFL. Yowarsky resigned the position at the end of the 1968 season, along with three other assistant coaches; Jack Faulkner, George Dickson, and Bob Shaw.
In 1969, Yowarsky accepted a position as the defensive backs coach for the Atlanta Falcons, under his former colleague Van Brocklin. He coached there until 1970. In 1971, he resigned from the Falcons and accepted a defensive line coaching position with the Houston Oilers. He finished his coaching career with the San Diego Chargers from 1972 to 1973.
Scouting
After retiring from coaching, Yowarsky became a scout with the QUADRA Scouting Combine in 1974. He was hired as an area scout in the southeast by the Dallas Cowboys in 1977, a post that he would hold for 23 years. During that span, the Cowboys won three Super Bowls. He was one of the most vocal supporters in the Cowboys organization for drafting Emmitt Smith, who would go on to become the all-time rushing leader in NFL history.
Personal life
Yowarsky was married to his wife, Bobbie, for 58 years, and they had three children. He served in the United States Air Force, attaining the rank of first lieutenant. Yowarsky died on November 30, 2014 in Chattanooga, Tennessee.
References
External links
1928 births
2014 deaths
American football defensive ends
Atlanta Falcons coaches
Dallas Cowboys scouts
Detroit Lions players
Houston Oilers coaches
Kentucky Wildcats football players
Minnesota Vikings coaches
New Orleans Saints coaches
New York Giants coaches
New York Giants players
New York Giants scouts
San Diego Chargers coaches
San Francisco 49ers players
Washington Redskins players
United States Air Force officers
Coaches of American football from Ohio
Players of American football from Cleveland
Military personnel from Cleveland |
Ed Schieffer (born November 28, 1949) was a Democratic member of the Missouri House of Representatives. He represented the 11th District, encompassing all or parts of Lincoln county. Schieffer was first elected to the Missouri House in November, 2006, and reelected in 2008, 2010 and 2012.
Personal history
Edward L. Schieffer was born in Troy, Missouri, the oldest son of Albert and Betty (Zalabak) Schieffer, and raised on the family farm nearby. Following his graduation from Troy Buchanan High School in 1967, Schieffer attended Northeast Missouri State College in Kirksville where he earned a Bachelor's degree in Education in 1971. He would later earn a Master's degree in Education from Southern Illinois University Edwardsville in 1977. Schieffer taught in Missouri schools for nearly three decades and is also a licensed insurance salesman, auctioneer, and real estate broker. He is a 4th degree Knights of Columbus member. Ed Schieffer and wife Maria live on their family farm near Troy, Missouri. They are the parents of two grown children.
Political history
Ed Schieffer's first attempt at public office came in 2002 when he ran for the Missouri State Senate 2nd District seat, losing to Republican Jon Dolan by nearly 11,000 votes. Schieffer was more successful in his next attempt, winning the Missouri 11th District State Representative race in 2006, defeating Republican Milton Schaper and Libertarian candidate Gregory James Arrigo. He won re-election in 2008, 2010 and 2012. In 2014, he tried for the Senate again, this time in the 10th District.
Legislative assignments
Rep. Schieffer will serve on the following committees during the 96th General Assembly:
Agri-Business
Agriculture Policy
Appropriations - Transportation and Economic Development subcommittee
Transportation
References
1949 births
Living people
People from Troy, Missouri
Democratic Party members of the Missouri House of Representatives
Schoolteachers from Missouri
Truman State University alumni
Southern Illinois University Edwardsville alumni |
The 2019 Torneig Internacional de Tennis Femení Solgironès was a professional tennis tournament played on outdoor clay courts. It was the fourth edition of the tournament which was part of the 2019 ITF Women's World Tennis Tour. It took place in La Bisbal d'Empordà, Spain between 13 and 19 May 2019.
Singles main-draw entrants
Seeds
1 Rankings are as of 6 May 2019.
Other entrants
The following players received wildcards into the singles main draw:
Eva Guerrero Álvarez
Claudia Hoste Ferrer
Sabine Lisicki
Renata Zarazúa
The following players received entry by special exempts:
Nadia Podoroska
Daniela Seguel
The following players received entry from the qualifying draw:
Naiktha Bains
Mirjam Björklund
Dalma Gálfi
Francesca Jones
Marta Kostyuk
Rosa Vicens Mas
Champions
Singles
Wang Xiyu def. Dalma Gálfi, 4–6, 6–3, 6–2
Doubles
Arina Rodionova / Storm Sanders def. Dalma Gálfi / Georgina García Pérez, 6–4, 6–4
References
External links
2019 Torneig Internacional de Tennis Femení Solgironès at ITFtennis.com
Official website
2019 ITF Women's World Tennis Tour
2019 in Spanish sport |
Philippe Dehouck (born 2 August 1966) is a French former professional football player and manager.
Playing career
Dehouck was born in Lille, but began his professional career in the city of Thonon-les-Bains. He played two seasons in the Division 2 with Thonon before joining Paris Saint-Germain in 1987.
On 27 February 1988, Dehouck made his debut for PSG in a 0–0 draw against Bordeaux. He played his final match for the club on 30 April 1988, a 4–0 loss to Nice. For the following two seasons, Dehouck was loaned out to Annecy in the Division 2; he played a total of 58 games for the club.
Career statistics
References
Living people
1966 births
Footballers from Lille
French men's footballers
Men's association football midfielders
Paris Saint-Germain F.C. players
SO Châtellerault players
FC Annecy players
Ligue 1 players
Ligue 2 players
French Division 3 (1971–1993) players
French football managers
Championnat National players |
Gordon Enoch Gates (11 January 1897 – 11 June 1987) was an American zoologist.
Biography
Gates was born in Warner, New Hampshire, in 1897. He graduated from Colby College in 1919. From 1921 to 1941, he served as the head of Biology Department at Judson College in Burma. Then, from 1941 to 1946 he became a professor of biology at Rangoon College. he was a fellow at Museum of Comparative Zoology from 1946 to 1947, followed by being a Professor of Biology at Colby College from 1948 to 1950. He then became a guggenheim fellow from 1951 to 1952. His main focus was the morphology, physiology, taxonomy, and zoogeography of earthworms, a collection of which he donated to the National Museum of Natural History. He retired from his position in 1952.
References
1897 births
1987 deaths
20th-century American zoologists
Colby College alumni
Academic staff of the University of Yangon
People from Warner, New Hampshire
Harvard University alumni |
Villeneuve-d'Ascq (; ) is a commune in the Nord department in northern France. With more than 60,000 inhabitants and 50,000 students, it is one of the main cities of the Métropole Européenne de Lille and the largest in area (27.46 km²) after Lille. It is also one of the main cities of the Hauts-de-France region.
Built up owing to the merger between the former communes of Ascq, Annappes and Flers-lez-Lille, Villeneuve-d'Ascq is a new town and the cradle of the first automatic metro system of the world (VAL).
Villeneuve-d'Ascq is nicknamed the 'green technopole' thanks to the implantation of many researchers, including two campuses of the University of Lille and many graduate engineering schools, and companies in a pleasant living environment. Owing to its activity centres, its Haute Borne European scientific park and two shopping malls, Villeneuve-d'Ascq is one of the main economic spots of the Hauts-de-France region; multinational corporations such as Bonduelle, Cofidis and Decathlon have their head office there.
Outside its academic, scientific and business facilities, Villeneuve-d'Ascq is known for its sporting events, boasting two stadiums (Stade Pierre-Mauroy and Stadium Lille Métropole) and some top division sports teams, its museums, e.g. the Lille Métropole Museum of Modern, Contemporary and Outsider Art), its green spaces, and its facilities for disabled people.
Name
Its name means "new city of Ascq" in French. Ascq is possibly derived from the Dutch word for "ash". The name of the city is generally written without the customary (official) hyphen.
Geography
The city counts approximately of greenspace, lakes, forests and arable lands. It is located between Lille and Roubaix, at the crossroads of the principal freeways towards Paris, Ghent, Antwerp and Brussels.
History
Development on what is now Villeneuve-d'Ascq can be traced back to the Celtic Gaul era, and are anchored in two feudal mounds, a Gallo-Roman site and a Carolingian one.
The area was selected in the 1960s to accommodate a new town then designated the name Lille-Est, which was to channel the growth of the agglomeration of Lille city and development of institutions based in the area. The commune of Villeneuve-d'Ascq was created in 1970 by the amalgamation of the communes of Ascq, Annappes and Flers. Its name evokes at the same time the new (neuve) and the old: former commune Ascq and its memory as martyr town of 1 April 1944, date on which the Nazis massacred 86 men (Ascq massacre).
The city's merger with Lille was contentious and failed twice (1972 and 1976).
Population
Data before 1970 in the table and graph below refer to the old commune Annappes, before the merger with Ascq and Flers-lez-Lille.
Economy
Businesses and public organizations
Different kinds of businesses have their headquarters in Villeneuve d'Ascq because of the availability of land, the presence of researchers (in particular in the Cité Scientifique and Haute Borne) and the proximity to both Benelux and Paris economic regions. Villeneuve d'Ascq notably hosts the headquarters of the food processing company Bonduelle, the financial services provider Cofidis, the sporting goods retailer Decathlon, the chocolate manufacturer Bouquet d'Or, the disposable dishes manufacturer Tifany Industrie, the IT security company Netasq, the restaurant chains Flunch, Les 3 Brasseurs, Pizza Paï.
Furthermore, Villeneuve d'Ascq hosts the Europe, the Middle East and Africa headquarters of IT consulting company SoftThinks and the European headquarters and R&D center of Canadian frozen foods company McCain Foods. It is home to the central buying service of international retail group Auchan, a R&D center of multinational agri-processor Tate & Lyle, and a data processing center of American company Xerox.
Villeneuve d'Ascq also hosts numerous administration and public organizations offices. The Northern headquarters of French national meteorological service Météo-France, large barracks of the National Gendarmerie (450 gendarmes and their family), the Northern headquarters of the Regional Center for Traffic Information and Coordination (:fr:Centre régional d'information et de circulation routière). Since 1998, there are large offices of the mobile network operator and Internet service provider Orange, along with the information computing center of Électricité de France for the Northern and Western France region.
From 1984 to 1994 Villeneuve d'Ascq housed a Groupe Bull factory that developed, manufactured and marketed desktops personal computers; the site is currently used by offices of Decathlon. There was also a Rhône-Poulenc chemical factory, now housing offices of mail order company 3 Suisses.
Villeneuve d'Ascq hosts the Northern head office of Textile and Clothing French Institute (IFTH) which assist industry for their technological and economical development. Finally, 2000 businesses are implanted in the city.
Shops and trade
Two huge shopping centers are located in the technopole. The indoor/roofed Centre commercial V2, founded in 1977, which, when created, was the largest shopping center north of Paris and is still the largest in the Nord-Pas-de-Calais area. A new outdoor one opened in 2009, Heron Parc, a shopping center located near V2, hosting numerous stores of Groupe Auchan and a 12 auditoriums movie theater.
Education and science
Villeneuve d'Ascq is the first academic pole of the metropolitan area. Numerous academic and scientific facilities are located there (around 42,000 students and 2,500 researchers).
Universities and tertiary institutions
The city hosts two main campuses of the University of Lille : "Cité Scientifique" (Science and Technology); and "Pont de Bois" (Social sciences, Humanities, Literature and Arts). Those two campuses count a half of the Community of Universities and Institutions (COMUE) Lille Nord de France students.
Villeneuve d'Ascq hosts also a University Institute for Technology (IUT A), the school in architecture École nationale supérieure d'architecture et de paysage de Lille, along with five graduate schools : École centrale de Lille, École nationale supérieure de chimie de Lille, Polytech'Lille (formerly EUDIL), École des Mines-Télécom de Lille-Douai (IMT) (formerly ENIC, TELECOM LILLE), École supérieure des techniques industrielles et des textiles (ESTIT).
Primary and secondary education
There are 20 public maternelles (preschools/nurseries), 17 public élémentaires (primary schools), and 6 public combined preschools and elementary schools. There are also five public collèges (junior high schools): Camille Claudel, Simone de Beauvoir, Moliere, Rimbaud, and Triolo. The two public lycées (senior high schools/sixth-form colleges) in the commune are Lycée Raymond Queneau and Lycée professionnel Dinah Derycke.
There is one combined private elementary through high school, École Saint-Adrien. There is also a private junior high school, Collège privé communautaire; and four private combined preschool and elementary schools, Notre-Dame, Saint-Pierre d'Ascq, Cardinal Liénart, and Saint-Henri.
Miscellaneous education
200 public and private laboratories whose 31 of them members of French National Centre for Scientific Research are located in the technopole. Some main research institute are situated in Villeneuve d'Ascq, for example IEMN (Institut d'électronique de microélectronique et de nanotechnologie), INRIA Lille (National Institute for Research in Computer Science and Control), IFSTTAR (Institut national de recherche sur les transports et leur sécurité), INRA (Institut National de la Recherche Agronomique), the veterinary laboratory of the Nord department, l'IRIS (Institut de recherche de l'industrie sucrière), ITF-Nord (Institut textile de France).
At last but not least, the technopole hosts the European scientific park Haute Borne, 150 hectare next to Université Lille 1.
Administration
Having succeeded Gérard Caudron as mayor from 1977 to 2001, Jean-Michel Stievenard and his team wish to maintain balances the environnement and the economic development, the greenery and technology, the daily wellbeing and the great projects, the social one and quality, opening on its internal comfort and rest of the world, its finance and high degree of public utility. The mayors of Villeneuve-d'Ascq since 1977 have been members of the Socialist Party (Parti socialiste).In 2008, the local elections brought back to the city council Gerard Caudron as mayor.
Villeneuve-d'Ascq is the seat of the canton of Villeneuve-d'Ascq.
Transport
As a part of the Métropole Européenne de Lille, Villeneuve-d'Ascq is connected to Lille city centre by a VAL, a type of fully automatic (driverless) light rubber-tired metro.
The VAL metro line runs through Villeneuve-d'Ascq from Quatre-Cantons and Cité Scientifique stations and drives up to Lille historical city centre and railways stations in about ten minutes.
In fact, while the acronym VAL now officially stands for Véhicule Automatique Léger (automatic light vehicle), it was originally for Villeneuve-d'Ascq à Lille (meaning Villeneuve-d'Ascq to Lille), the route of the first line to be projected, and inaugurated on 25 April 1983. The Villeneuve d'Ascq metro station is under the Place Salvador Allende (Salvadore Allende Square) and a shopping centre which includes Auchan as one of its main tenants.
Villeneuve-d'Ascq is also served by the train station Gare d'Ascq, which offers connections to Lille, Orchies and Tournai and Liège in Belgium.
Sport
Honours and statistics
The city received many awards for its sporting activities. In 1994, the newspaper L'Equipe ranked Villeneuve d'Ascq in the five most sportive cities in France. In 1996, Villeneuve d'Ascq was elected the 'most sportive city of France', and in 1999, 'the most disabled sportive city'. It is a logical result because the city invests a lot in sport.
In 2009, 21,700 inhabitants had a sport licence in the sport club of Villeneuve d'Ascq (one third of the global population of the city) ; the city hosts 158 different sport associations, 58 different sports and 14% of the city operating budget is dedicated to sport.
The city has 10.99 hectares of soccer and rugby fields, of track and field facilities and of hiking trails.
Facilities
Villeneuve d'Ascq has two swimming pools ('piscine du Triolo' and 'centre nautique Babylone') both equipped with a 50m long water slide, an outside grass area, saunas and a training gym.
The city hosts two major stadiums, Stadium Lille Métropole (21,650 seats) and Stade Pierre-Mauroy (50,186 seats).
Villeneuve d'Ascq have 16 soccer fields, 2 rugby fields (stadium E. Théry, Tradition street), 17 municipal gymnasiums plus 8 academic gymnasiums (E.S.U.M.), a sport complex called 'Palacium' (Pont de Bois avenue) and a gymnasium (salle d'Agrees, Breughel street) dedicated to gymnastics.
The city hosts a sailing base, two shooting galleries, a bow and arrow gallery, two golf courses, 12 tennis courts, two athletics facilities (Parmentier street and Lieutenant Colpin street).
Finally, we can find in Villeneuve d'Ascq two dojos, a big wall for wall-climbing (salle Tamise), a bourloire in Ascq, a boulodrome in Residence and a bowling in Hôtel de Ville.
Sporting events and teams
Football (soccer)
Villeneuve d'Ascq is home to several football teams which play in the Nord-Pas-de-Calais football league, in Flandre district: US Ascq (promotion d'honneur), Villeneuve d'Ascq Métropole (promotion d'honneur) and Flers OS Villeneuve d'Ascq (1ère division de district).
The Stadium Nord hosted two international exhibition games: France - Tunisia in 1978 and France - Armenia in 1996. The Stadium Nord is the official stadium of the Lille Olympique Sporting Club Lille Métropole team (Ligue 1) since the 2004-2005 season, and also the official stadium of the Entente Sportive de Wasquehal team since 1997-1998 season (formerly Ligue 2, today CFA 2). In 1997, Stadium Nord was the home stadium of the Royal Excelsior Mouscron for the UEFA Europa League. The stadium hosted the UEFA Europa League matches of Lille Olympique Sporting Club Lille Métropole, so prestigious clubs such as Fenerbahçe SK, FC Sevilla, Valencia CF and Liverpool FC came to Villeneuve d'Ascq.
In 2010, the Fédération française de football organised in Stadium Nord the Festifoot féminin, an event with 500 feminine soccer player footballeuses. The France women's national football team were there and also some women's international footballers.
In May, 2010 Stade Pierre-Mauroy was selected by the Fédération française de football (FFF) to host matches in the UEFA Euro 2016, hosted by France.
Rugby
Villeneuve d'Ascq is home to a rugby union team, Lille Métropole Rugby Club Villeneuvois (ex-Rugby Club Villeneuve d'Ascq), whose senior women's team takes part in France women's rugby union championship. The women's team is in Division 1 since 1999 and in Elite since his victory ath the Challenge Armelle Auclair in 2006.
The Stadium Nord hosted the quarter-final of Rugby World cup in 1991 New Zealand vs. Canada (36 000 spectators). It also hosted the semi-final of European Rugby Cup 2000-2001 Stade français vs. Munster. In 2005, Stadium Nord hosted matches from the under 17 y.o. rugby tournament.
The Stadium Nord frequently hosts exhibition matches of the France rugby A team.
Track and field
The Stadium Nord hosts every year since 1988 an international meeting of track and field (formerly called meeting open Gaz de France, then Open du Nord and now meeting d'athlétisme Lille Métropole). The meeting is part of the national athletism league since 2007.
In Stadium Nord took place the Track and field European Cup in 1995 and the Disabled Track and field World Cup in 2002.
Other sports
Villeneuve d'Ascq has a famous basketball club, ESB Villeneuve-d'Ascq which plays in Ligue Féminine de Basketball.
The city has also an american football club, Vikings de Villeneuve d'Ascq (Division 2) and a handball club, Hand Ball Club Villeneuve d'Ascq (HBCV) (Division 2).
The cycling tournament Tour de France arrived in Villeneuve d'Ascq in 1988. Sportsmen who came from Villeneuve d'Ascq clubs include tennis players Sarah Pitkowski and Nathalie Dechy.
Culture
The city keeps of its past of many vestiges, sites and equipment.
Villeneuve-d'Ascq possesses a famous museum, the Lille Métropole Museum of Modern, Contemporary and Outsider Art (LaM). One can visit the forum of sciences François Mitterrand, the rebuildings of a Gaulois village to the archeological park Asnapio.
Twin towns – sister cities
Villeneuve-d'Ascq is twinned with:
Haidari, Greece
Iași, Romania
Leverkusen, Germany
Ouidah, Benin
La Possession, Réunion, France
Racibórz, Poland
Stirling, Scotland
Tournai, Belgium
Gallery
See also
Communes of the Nord department
References
External links
Museum of modern art
Forum des sciences (Centre François Mitterrand)
Office of tourism
Communes of Nord (French department)
Science parks in France
High-technology business districts in France
Planned communities in France
New towns started in the 1960s
French Flanders |
The Birds, the Bees and the Italians is a 1966 italian film directed by Pietro Germi. Its original Italian title is Signore & Signori, which means 'Ladies and Gentlemen'.
Plot
The film is set in an unspecified town in the Veneto region, which is indicated in the sign of the local newspaper as Rezega (and the cars have an imaginary RZ license plate). The plot revolves around the vicissitudes of a company of merchants and professionals from the middle-upper middle class who, behind an impeccable facade of respectability, hide a dense, implied plot of mutual betrayals.
As anthology film, presents three storylines. In the first story, Toni Gasparini, as much admired as feared by his friends, confesses to Dr. Castellan, a doctor and friend, that he has been powerless for many months now, to make him lower his guard against his young and vivacious wife Noemi. The doctor spreads his confidence with insensitive lightness in his circle of friends, for the pure pleasure of his gossip, unaware that he is supporting his plan. At the end of a party, Castellan, together with the others, continues the fun night in a night club and allows Toni to take Noemi home. When a friend, incredulous of the rumor of Gasparini's impotence, reveals that he witnessed the man's latest adventure some ten days earlier, the doctor rushes home, but arrives too late to prevent his willing wife from being seduced and is forced to hide what happened, to save his honor.
In the second, the accountant Osvaldo Bisigato, a modest bank employee, afflicted by a wife, Gilda, oppressive and rancorous, who constantly reproaches him for failures and lack of ambition, believes he can start a new life by running away with Milena Zulian, the young and beautiful cashier of the bar attended by the whole party, who reciprocate his interest. But, while cheating is tacitly permitted, separation is not socially acceptable, and so the whole town unites against him: his wife's cousin (the influential Ippolita, Gasparini's wife), the same "friends" or presumed such; the employer, the parish priest and even the commander of the Carabinieri: all to force him to retrace his steps and maintain the illusion of the sanctity of the conjugal union. Don Schiavon convinces Milena to leave the city and Bisigato, after a suicide attempt and hospitalization, returns to the ranks submissive and resigned.
In the third, Alda Cristofoletto, a young and beautiful country girl, who arrived in the city to shop, does not go unnoticed in the eyes of a group of womanizing friends, who one after another they take advantage of his availability. But the next day the farmer Bepi Cristofoletto, father of the girl, just sixteen, denounces them all for corruption of a minor. To prevent the community from being marked by scandalof the trial, while the economic "potentate" and the religious authorities silenced the local press (a series of phone calls asked the reporter Tosato to delete one name, another, until there was no guilty person left in the piece), the icy and calculating Ippolita, wife of one of the accused, convinces the naive and honest farmer Cristofoletto to withdraw the complaint, offering him in exchange a large sum of money and giving it to him, thus satisfying his carnal desires and keeping for himself (or better for the poor) a large part of the money raised for "brokerage".
The film shared the Grand Prix with A Man and a Woman at the 1966 Cannes Film Festival. It was later selected for screening as part of the Cannes Classics section at the 2016 Cannes Film Festival.
In 2008, the film was included on the Italian Ministry of Cultural Heritage’s 100 Italian films to be saved, a list of 100 films that "have changed the collective memory of the country between 1942 and 1978."
Cast
Virna Lisi – Milena Zulian
Gastone Moschin – Osvaldo Bisigato
Nora Ricci – Gilda Bisigato
Alberto Lionello – Toni Gasparini
Olga Villi – Ippolita Gasparini
Franco Fabrizi – Lino Benedetti
Beba Lončar – Noemi Castellan
Gigi Ballista – Giacinto Castellan
Carlo Bagno – Bepi Cristofoletto
Patrizia Valturri – Alda Cristofoletto
Virgilio Gazzolo – Newspaper editor
Quinto Parmeggiani – Giovanni Soligo
Gia Sandri – Betty Soligo
Moira Orfei – Giorgia Casellato
Virgilio Scapin – Don Schiavon
References
External links
Cannes profile
1966 films
Italian black-and-white films
Palme d'Or winners
Commedia all'italiana
1960s sex comedy films
1960s Italian-language films
Films shot in Veneto
Films directed by Pietro Germi
Films scored by Carlo Rustichelli
Italian anthology films
Films with screenplays by Luciano Vincenzoni
Commedia sexy all'italiana
Films set in Veneto
1966 comedy films
1960s Italian films |
The seventh and final season of the American television drama series Mad Men premiered on April 13, 2014, and concluded on May 17, 2015, on AMC. The season consists of 14 episodes split into two, seven-episode parts: the first half, titled "The Beginning", aired from April 13 to May 25, 2014; and the second half, titled "The End of an Era", aired from April 5 to May 17, 2015. The first part of the seventh season was released on Blu-ray/DVD on October 21, 2014, and the second half was released on October 13, 2015. Each episode in the season has a running time of approximately 48 minutes, with the exception of the final two episodes which are 54 and 57 minutes, respectively.
The first part of season 7 begins in January 1969, several weeks after the Thanksgiving 1968 ending of season 6, with characters dealing with the dynamics of lives and offices being split between New York and Los Angeles, and ends in July 1969. The second part of season 7 takes place between April and November 1970. Both halves received critical acclaim, and based on year-end lists published by television critics, Mad Mens seventh season was the seventh most acclaimed series of 2014 for its first seven episodes, and was the second most acclaimed series of 2015 for its final episodes.
Cast
Main cast
Jon Hamm as Don Draper
Elisabeth Moss as Peggy Olson
Vincent Kartheiser as Pete Campbell
January Jones as Betty Francis
Christina Hendricks as Joan Harris
Aaron Staton as Ken Cosgrove
Rich Sommer as Harry Crane
Kiernan Shipka as Sally Draper
Jessica Paré as Megan Draper
Kevin Rahm as Ted Chaough
Christopher Stanley as Henry Francis
Jay R. Ferguson as Stan Rizzo
Ben Feldman as Michael Ginsberg
Mason Vale Cotton as Bobby Draper
Robert Morse as Bert Cooper
John Slattery as Roger Sterling
Recurring cast
Guest stars
Linda Cardellini as Sylvia Rosen
Rebecca Creskoff as Barbara Katz
Anne Dudek as Francine Hanson
Marten Holden Weiner as Glen Bishop
Rich Hutchman as Bud Campbell
Mark Moses as Herman "Duck" Phillips
Brian Markinson as Dr. Arnold Rosen
Larisa Oleynik as Cynthia Cosgrove
Maggie Siff as Rachel Katz (née Menken)
Ray Wise as Ed Baxter
James Wolk as Bob Benson
Episodes
Reception
Critical reception
The seventh season of Mad Men received general acclaim. The review aggregator Rotten Tomatoes reports that 90% of 510 critics reviewed the season favorably with an average score of 8.85/10. The site's consensus is: "Just in time to rekindle viewers' interest, Mad Men gets back on track for one last season, revisiting its steady, deliberate pace and style on its way to a sure-to-be-compelling climax." On Metacritic, the first part of the seventh season scored 85 out of 100 based on 26 reviews; the second part scored 83 out of 100, based on 19 reviews, both indicating "universal acclaim".
Accolades
For the 66th Primetime Emmy Awards, the first half of the season was nominated for Outstanding Drama Series, Jon Hamm was nominated for Outstanding Lead Actor in a Drama Series, Christina Hendricks was nominated for Outstanding Supporting Actress in a Drama Series, and Robert Morse was nominated for Outstanding Guest Actor in a Drama Series. For the 67th Writers Guild of America Awards, the series was nominated for Best Drama Series and Jonathan Igla and Matthew Weiner were nominated for Best Episodic Drama for "A Day's Work".
For the 31st TCA Awards, the series was nominated for Program of the Year and Outstanding Achievement in Drama, and Hamm won for Individual Achievement in Drama. For the 67th Primetime Emmy Awards, Jon Hamm won for Outstanding Lead Actor in a Drama Series after eight consecutive nominations. The series received nominations for Outstanding Drama Series, Elisabeth Moss for Outstanding Lead Actress in a Drama Series, Christina Hendricks for Outstanding Supporting Actress in a Drama Series, Semi Chellas and Matthew Weiner for Outstanding Writing for a Drama Series for "Lost Horizon", and Weiner in the same category for "Person to Person". For the 68th Writers Guild of America Awards, the series won for Best Drama and Matthew Weiner was nominated for Best Episodic Drama for "Person to Person". For the 22nd Screen Actors Guild Awards, the cast was nominated for Best Drama Ensemble and Jon Hamm was nominated for Best Drama Actor. For the 73rd Golden Globe Awards, Jon Hamm won for Best Drama Actor. For the 68th Directors Guild of America Awards, Matthew Weiner was nominated for Outstanding Directing – Drama Series for "Person to Person".
References
External links
2014 American television seasons
2015 American television seasons
Television series set in 1969
Television series set in 1970
Split television seasons |
İbrahim Adnan Saraçoğlu (1949, Safranbolu) is a Turkish chemistry professor, biochemist, microbiologist and researcher.
After his chemistry studies, he completed his PhD studies at the Karl-Franzens University and became an assistant at the Institute for Molecular Biosciences. Between 1985 and 1986, he worked at the Çukurova University and made his doctorate in 1987. In 1994, he became a professor.
He was a lecturer at the Karl-Franzens University and also was researcher/academic manager at the Institute for Physics and Biomedical Sensors of the AVL List.
Saraçoğlu worked at the Vienna Technical University as a professor. He is the author of a number of articles in international scientific publications and owns a number of patents. Currently, he continues his research on botany and the influence of plants on human health focusing on the field of phytho-biochemistry.
Through his research, he concluded the healing effect of broccoli against prostatitis and benign prostata enlargement and the healing effect of lavender against hepatitis B and hepatitis C. He was the first to coin the term of "Preventive Vegetal Therapy" and built/stated its principles.
References
External links
1. Austrian Cancer Forum (German)
Web seite of Prof. Dr. Saraçoğlu
We are eating garbage!
1949 births
Living people
Turkish biologists
Turkish chemists |
The Corvallis Hotel, located in Corvallis, Oregon, is listed on the National Register of Historic Places.
See also
National Register of Historic Places listings in Benton County, Oregon
References
External links
1927 establishments in Oregon
Georgian architecture in Oregon
Hotel buildings completed in 1927
Hotels in Corvallis, Oregon
National Register of Historic Places in Benton County, Oregon
Frederick Manson White buildings
Historic American Buildings Survey in Oregon |
The women's 4 × 5 km relay cross-country skiing competition at the 1992 Winter Olympics in Albertville, France, took place on 18 February at Les Saisies. The race saw the Unified Team beat Norway by 21.6 seconds, with Italy finishing third.
Results
Sources:
References
External links
Results International Ski Federation (FIS)
Women's cross-country skiing at the 1992 Winter Olympics
Women's 4 × 5 kilometre relay cross-country skiing at the Winter Olympics |
```xml
import { getMetadataArgsStorage } from "../../globals"
import { TableMetadataArgs } from "../../metadata-args/TableMetadataArgs"
import { DiscriminatorValueMetadataArgs } from "../../metadata-args/DiscriminatorValueMetadataArgs"
/**
* Special type of the table used in the single-table inherited tables.
*/
export function ChildEntity(discriminatorValue?: any): ClassDecorator {
return function (target: Function) {
// register a table metadata
getMetadataArgsStorage().tables.push({
target: target,
type: "entity-child",
} as TableMetadataArgs)
// register discriminator value if it was provided
if (typeof discriminatorValue !== "undefined") {
getMetadataArgsStorage().discriminatorValues.push({
target: target,
value: discriminatorValue,
} as DiscriminatorValueMetadataArgs)
}
}
}
``` |
Girouard Lake is a freshwater body of water crossed by the Mégiscane River, in the north-eastern part of Senneterre, in La Vallée-de-l'Or Regional County Municipality (RCM), in the administrative region of Abitibi-Témiscamingue, in the province of Quebec, in Canada.
Girouard Lake is located entirely in the township of Girouard. Forestry is the main economic activity of the sector. Recreational tourism activities come second.
The hydrographic slope of Lake Girouard is accessible via the Faillon Lake Road (East-West direction) that passes on the south side of Lake Girouard; in addition, another forest road (East-West direction) serves an area northwest of the Mégiscane River which includes the southern part of the Lake Wetetnagami Biodiversity Reserve.
The surface of Girouard Lake is usually frozen from early November to mid-May, however safe ice circulation is generally from mid-November to mid-April.
Geography
Toponymy
The hydronym "Lac Girouard" is linked to that of the township of Girouard. The term "Girouard" is a family name of French origin.
The toponym "lac Girouard" was formalized on December 5, 1968, by the Commission de toponymie du Québec, when it was created.
Notes and references
See also
Lakes of Abitibi-Témiscamingue
Nottaway River drainage basin |
Mary Jane Kelly ( – 9 November 1888), also known as Marie Jeanette Kelly, Fair Emma, Ginger, Dark Mary and Black Mary, is widely believed by scholars to have been the final victim of the notorious unidentified serial killer Jack the Ripper, who murdered at least five women in the Whitechapel and Spitalfields districts of London from late August to early November 1888. At the time of Kelly's death, she was approximately 25 years old, working as a prostitute and living in relative poverty.
Unlike the other four canonical Ripper victims—each of whom had been murdered outdoors and whose mutilations could have been committed within minutes—Kelly was murdered within the sparsely furnished single room she rented at 13 Miller's Court, affording her murderer an extensive period of time to eviscerate and mutilate her body. Kelly's body was by far the most extensively mutilated of the canonical victims, with her mutilations taking her murderer approximately two hours to perform.
Early life
Compared with the other four canonical Ripper victims, Mary Kelly's origins are obscure and undocumented, and much of this information is possibly embellished. Kelly may have fabricated many details of her early life as there is no corroborating documentary evidence, but there is no evidence to the contrary either. According to Joseph Barnett, the man she had most recently lived with prior to her murder, Kelly had told him she was born in Limerick, Ireland, in around 1863—although whether she referred to the city or the county is not known—and that her family moved to Wales when she was a child.
Kelly is known to have claimed to one acquaintance that her parents had disowned her, although she remained on close terms with her sister. She described her family to Barnett as moderately wealthy, and both he and a reported former landlady of Kelly's, Mrs Carthy, claimed that Kelly came from a family of "well-to-do people". Barnett reported that Kelly had informed him her father was named John Kelly and that he worked in an ironworks in either Caernarfonshire or Carmarthenshire. Barnett also recalled Kelly mentioning having seven brothers and at least one sister. One brother, named Henry, supposedly served in the 2nd Battalion Scots Guards. She once stated to a friend named Lizzie Albrook that a female family member was employed at the London theatrical stage. Her landlord, John McCarthy, also claimed that Kelly received infrequent correspondence from Ireland.
Carthy described Kelly as being "an excellent scholar and an artist of no mean degree". However, at the inquest into Kelly's murder, Barnett informed the coroner that in the months prior to her murder, she had often asked him to read newspaper reports of the Whitechapel murders to her, suggesting that she was illiterate.
Newspaper accounts dating from November 1888 claim Kelly was known as "Mary McCarthy", which may have been a mix up with either the surname of her landlord at the time of her death or the surname of a previous landlady with whom she had lived until about 1886.
Appearance
Kelly has been reported as being a blonde or redhead, although her nickname "Black Mary" may suggest she had dark hair. Her eyes were blue. To some, Kelly was known as "Fair Emma", although it is unknown whether this applied to her hair colour, her skin colour, her beauty, or other qualities. Some contemporary newspapers report she was nicknamed "Ginger" after her hair (though sources disagree even on this point, thus leaving a description of hair colour ranging from ash blonde to dark chestnut).
Contemporary reports estimated Kelly's height at 5 feet 7 inches (1.70 metres). Detective Walter Dew, in his autobiography, claimed to have known Kelly well by sight. He described her as "quite attractive" and "a pretty, buxom girl". According to Dew, she always wore a clean white apron but never a hat. Sir Melville Macnaghten of the Metropolitan Police Force (who never saw Kelly prior to her death) reported that she was known to have "considerable personal attractions" by the standards of the time. The Daily Telegraph of 10 November 1888 described her as "tall, slim, fair, of fresh complexion, and of attractive appearance".
Marriage
When Kelly was aged approximately 16 in about 1879, she reportedly married a coal miner named Davis or Davies, who was killed two or three years later in a mining explosion. Without any means of financial support, Kelly relocated to Cardiff, where she lived with a cousin. Although there are no contemporary records of Kelly's presence in Cardiff, it is at this stage in her life that Kelly is considered to have begun her career as a prostitute, possibly being introduced to this profession by her cousin. No South Wales Police records exist to indicate Kelly was arrested for prostitution.
Relocation to London
In 1884, Kelly apparently left Cardiff and relocated to London, where she briefly worked for a tobacconist in Chelsea before securing employment as a domestic servant while lodging in Crispin Street, Spitalfields. The following year, Kelly is believed to have relocated to the central London district of Fitzrovia.
Via her acquaintance with a young French woman whom Kelly had met in Knightsbridge, she found work in a high-class brothel in the more affluent West End of London. She became one of the brothel's most popular girls and spent her earnings on expensive clothing and hiring a carriage. Reportedly, Kelly was invited by a client named Francis Craig to France, but returned to England within approximately two weeks, having disliked her life there. However, by the time of her return to London, Kelly had adopted the French name "Marie Jeanette".
East End
In 1885, Kelly briefly resided with a Mrs Buki in lodgings located near the London Docks North Quay. In the brief period of time she lodged with Buki, the two are known to have visited the home of a French lady living in Knightsbridge to demand the return of a box of expensive dresses belonging to Kelly. This information suggests Kelly's descent into East End life was markedly rapid and may have been influenced by her efforts to avoid retribution from a procurer. It is also believed to be at this stage in her life when Kelly began drinking heavily.
After leaving Buki's residence, Kelly lodged with a Mrs Carthy in Breezer's Hill, Ratcliffe Highway. According to this landlady, Kelly lived at her residence between 1885 and 1886, and she had left her residence to live with a builder whom Mrs Carthy later stated believed would have married her. Gravitating toward the poorer areas of the East End, Kelly reportedly lived with a man named Morganstone near the Commercial Gas Works in Stepney and later with a mason's plasterer named Joseph Flemming.
Acquaintance with Joseph Barnett
By 1886, Kelly was residing at Cooley's Lodging House in Thrawl Street, Spitalfields. On 8 April 1887, she became acquainted with 28-year-old Joseph Barnett, whom she first encountered on Commercial Street. Barnett—who worked as a fish porter at Billingsgate Market—took Kelly for a drink before arranging to meet her the following day.
Relationship and lodgings
The two agreed to live together upon their second meeting on 9 April. Initially, Barnett and Kelly lodged in George Street, close to Commercial Street. They later took lodgings in Little Paternoster Row, but were soon evicted for non-payment of rent and drunk and disorderly conduct. They later took lodgings in Brick Lane, before relocating to Miller's Court, off Dorset Street, in either February or March 1888.
13 Miller's Court
In early 1888, Kelly and Barnett moved into 13 Miller's Court, a small, sparsely furnished single room at the back of 26 Dorset Street, Spitalfields. This room had once been the back parlour of 26 Dorset Street and was partitioned by a wooden wall. The weekly rent for this room was 4s 6d.
Number 13 Miller's Court was a single twelve-foot square room, with a bed, three tables and a chair. Above the fireplace hung a print of "The Fisherman's Widow", and a small tin bath was beneath the bed. Two irregularly sized windows faced the yard, in which the dustbin and water tap serving the property were located, and the door opened directly into the twenty-six-foot-long arched passageway which connected Miller's Court with Dorset Street. This door was illuminated at night by a gas lamp located almost directly opposite the door to the property.
Kelly had lost her door key, instead bolting and unbolting the door from outside by putting a hand through a broken window beside the door. A German neighbour, Julia Venturney, claimed Kelly had broken this window when drunk, and that a man's coat was frequently placed in this broken windowpane to both act as a curtain and prevent draught from entering the room.
According to Kelly's friend and neighbour, Lizzie Albrook, Kelly was "heartily sick" of the life she was leading by 1888 and wished to return to Ireland "where her people lived". Her landlord, John McCarthy, later recollected: "She was a very quiet woman when sober but noisy when in drink." When drunk, Kelly would often be heard singing Irish songs, although when intoxicated, she would often become quarrelsome and even abusive to those around her, which earned her the nickname "Dark Mary".
Barnett lost his employment as a fish porter in July 1888, reportedly due to committing theft. As a result, Kelly again resorted to prostitution. According to Barnett, she began to allow other prostitutes to sleep in their room on "cold, bitter nights" as she did not have the heart to refuse them shelter. Initially, Barnett was tolerant of this until he and Kelly quarrelled over her sharing the room with a prostitute he knew only as "Julia". Barnett subsequently left 13 Miller's Court on 30 October, more than a week before her death, taking lodgings at 24–25 New Street, Bishopsgate. Nonetheless, between 1 and 8 November, Barnett visited Kelly on an almost daily basis, occasionally giving her money.
8 November
Barnett visited Kelly for the last time between 7 and 8 p.m. on 8 November. He found her in the company of a friend of hers named Maria Harvey. Barnett did not stay at the property for long and apologised for having no money to give her. Both he and Harvey left Miller's Court at about the same time. Barnett returned to his lodging house, where he played cards with other residents until falling asleep at about 12:30 a.m. Shortly before Barnett left Miller's Court, Lizzie Albrook also visited Kelly. She later recollected that Kelly was sober, and one of the last things she had said to her was: "Whatever you do, don't you do wrong and turn out as I have." In the early evening, Kelly is known to have had one drink in the Ten Bells public house with a woman named Elizabeth Foster. Later that evening, Kelly was seen drinking with two acquaintances at the Horn of Plenty pub on Dorset Street.
Fellow Miller's Court resident and prostitute, 31-year-old Mary Ann Cox, who described herself as "a widow and unfortunate", reported seeing Kelly returning home drunk and in the company of a stout, ginger-haired man, aged approximately 36, at 11:45 p.m. This man was wearing a black felt bowler hat, had a thick moustache, blotches on his face, and was carrying a can of beer. Cox and Kelly wished each other goodnight, with Kelly adding, "I am going to have a song." Kelly then entered her room with the man, who closed the door as Cox returned to her own lodgings at 5 Miller's Court. Kelly was then heard singing the song "A Violet from Mother's Grave." She was still singing when Cox left her lodgings at midnight, and when she returned approximately one hour later, at 1 a.m. Elizabeth Prater resided in the room directly above Kelly. When she went to bed at 1:30 a.m., the singing had stopped.
9 November
Unemployed labourer George Hutchinson, who knew Kelly, reported the two had met at about 2 a.m. on 9 November on Flower and Dean Street and that Kelly asked him for a loan of sixpence. Hutchinson claimed to be broke, having spent his money in Romford the previous day. He later stated that as Kelly walked in the direction of Thrawl Street she was approached by a man of "Jewish appearance" and aged about 34 or 35. Hutchinson claimed he was suspicious of this man because, although Kelly seemed to know him, this individual's opulent appearance made him a suspicious character to be in the neighbourhood. The man had also made an obvious effort to disguise his features from Hutchinson by "[hiding] down his head with his hat over his eyes" as the two had passed him.
Hutchinson later provided the police with an extremely detailed description of the man right down to the colour of his eyelashes despite it being the early hours of the morning. He reported that he overheard them talking in the street opposite the court where Kelly was living; Kelly complained of losing her handkerchief, and the man gave her a red one of his own. Hutchinson claimed that he then heard Kelly state: "Alright my dear, come along. You will be comfortable." She and the man walked into 13 Miller's Court, and Hutchinson followed them. He saw neither one of them again, laying off his watch at about 2:45 a.m.
Hutchinson's statement appears to be partly corroborated by a laundress named Sarah Lewis, who reported that as she walked towards the courtyard at 2:30 a.m. to spend the night with her friends, the Keylers, who resided at 2 Miller's Court, she had observed two or three people standing near the Britannia pub, including a respectably dressed young man with a dark moustache talking with a woman. Both appeared to be drunk. A poorly dressed and hatless young woman also stood nearby. Opposite Miller's Court, Lewis observed a "stout-looking and not very tall" man standing at the entrance to the courtyard, observing the entranceway. As Lewis passed this man, she observed a man in the company of an obviously drunk woman further up the courtyard. Lewis was adamant as to the timing of these sightings as she recalled hearing the chiming of the Spitalfields Church clock.
Shortly after 1 a.m., Mary Ann Cox again left her room. She returned to her home at approximately 3 a.m. Cox reported hearing no sound and seeing no light from Kelly's room at this time, although she thought she heard someone leaving the residence at about 5:45 a.m.
Murder
Elizabeth Prater, who resided in the room directly above Kelly's and who had been awoken by her kitten walking over her neck, and Sarah Lewis, who had slept at number 2 Miller's Court on 8–9 November, both reported hearing a faint cry of "Murder!" between 3:30 a.m. and 4 a.m., but did not react because they reported that it was common to hear such cries in the East End. Lewis described this cry as "only one scream. I took no notice of it". She claimed not to have slept and to have heard people moving in and out of the court throughout the night. Prater did leave her room at approximately 5:30 a.m., to walk to the Ten Bells pub for a drink of rum. She saw nothing suspicious.
Discovery
On the morning of 9 November 1888, the day of the annual Lord Mayor's Day celebrations, Kelly's landlord, John McCarthy, sent his assistant, ex-soldier Thomas Bowyer, to collect the rent. Kelly was six weeks behind on her payments, owing 29 shillings. Shortly after 10:45 a.m., Bowyer knocked on her door but received no response. He then attempted to turn the handle, only to discover the door was locked. Bowyer then looked through the keyhole, but could not see anybody in the room. Pushing aside the clothing used to plug the broken windowpane and the muslin curtains which covered the windows, Bowyer peered inside the room—discovering Kelly's extensively mutilated corpse lying on the bed. She is believed to have died between three and nine hours before the discovery of her body.
Bowyer ran to report his discovery to McCarthy, who first verified his claims, then instructed Bowyer to inform the Commercial Street Police Station. Bowyer ran to the police station, stammering the words: "Another one. Jack the Ripper. Awful. [John] McCarthy sent me" to Inspector Walter Beck. Beck accompanied Bowyer to Miller's Court, and immediately requested the assistance of police surgeon George Bagster Phillips. He also gave orders preventing any individuals from entering or exiting the yard. Beck also arranged for news of the murder to be telegraphed to Scotland Yard, and requested the assistance of bloodhounds. The scene was attended by Superintendent Thomas Arnold and Inspector Edmund Reid from Whitechapel's H Division, as well as Frederick Abberline and Robert Anderson from Scotland Yard, who arrived at the crime scene between 11:30 a.m. and 1 p.m.
News of the discovery of another Ripper victim spread rapidly throughout the East End. Crowds estimated to number over 1,000 gathered at each end of Dorset Street, with many members of the public voicing their frustration and indignation at the news.
Arnold ordered the room broken into at 1:30 p.m. after the possibility of tracking the murderer from the room with bloodhounds was dismissed as impractical. A fire fierce enough to melt the solder between a kettle and its spout had burnt in the grate, apparently fuelled with women's clothing. Inspector Abberline thought Kelly's clothes were burnt by the murderer to provide light, as the room was otherwise only dimly lit by a single candle Kelly had purchased on 7 November.
After two official crime scene photographs had been taken, Kelly's body was taken from Miller's Court to the mortuary in Shoreditch, where her body was formally identified by Joseph Barnett, who was only able to recognise Kelly's body by "the ear and the eyes". John McCarthy also viewed the body at the mortuary and was also certain the deceased was Kelly.
Post-mortem
The mutilation of Kelly's corpse was by far the most extensive of any of the Whitechapel murders, likely because the murderer had more time to commit his atrocities in a private room, without fear of discovery over an extensive period of time, as opposed to in public areas. The autopsy of Kelly's body took two-and-a-half-hours to complete.
Thomas Bond and George Bagster Phillips examined the body. Phillips and Bond timed her death to about 12 hours before the examination. Phillips suggested that the extensive mutilations would have taken two hours to perform, and Bond noted that rigor mortis set in as they were examining the body, indicating that death occurred between 2 and 8 a.m. Bond's official documents pertaining to his examination of the decedent, the crime scene, and subsequent post-mortem state:
Phillips believed that Kelly had been killed by a slash to the throat and the mutilations performed afterward. Bond stated in a report that the knife used was about wide and at least long, but did not believe that the murderer had any medical training or knowledge. He wrote:
Inquest
The official inquest into Kelly's death was opened at the Shoreditch Town Hall on Monday 12 November. This inquest was presided over by the coroner for North East Middlesex, Roderick Macdonald, MP. The jury were duly sworn before being taken by Inspector Abberline to both view Kelly's body at the mortuary adjoining Shoreditch Church and the crime scene in Miller's Court. After approximately one hour, the jurors reconvened at Shoreditch Town Hall to hear witness testimony.
Character testimony
The first witness to testify was Joseph Barnett, who testified he had lived with Kelly for "one year and eight months" before the two had separated following a quarrel on 30 October over her allowing "a woman of bad character" to stay in her room, whom Kelly "took in out of compassion". Barnett explained that, despite this argument, he had remained on good terms with Kelly in the week following their separation, and that he had last seen her alive at approximately 7:45 p.m. on 8 November. On the final occasion he had seen Kelly, she had been "quite sober".
Discussing Kelly's background, Barnett related her Irish origins, her marriage at age 16 and subsequent relocation to Cardiff following the death of her husband. Barnett also emphasised his belief Kelly's cousin was the source of her leading a life of prostitution, stating: "She was following a bad life with her cousin, who, as I reckon, and as I often told her, was the cause of her downfall."
Following Barnett's testimony, Thomas Bowyer recounted his discovery of Kelly's body on 9 November. Bowyer stated he had first observed two pieces of flesh on the bedside table, then seen Kelly's extensively mutilated body. He had "at once went very quietly" to John McCarthy to inform him of his discovery. McCarthy had himself looked through the broken windowpane to verify Bowyer's discovery before the two had separately proceeded to the nearest police station to report their discovery.
Bowyer's testimony was then corroborated by McCarthy, who stated Bowyer had informed him: "Guv'nor, I knocked at the door, and could not make anyone answer. I looked through the window and saw a lot of blood." The two had reported their discovery to Inspector Reid at Commercial Street Police Station. McCarthy stated Kelly's rent was in arrears by 29 shillings. In discussing her character, McCarthy described Kelly as an "exceptionally quiet woman" when sober, but that "when in drink she had a lot more to say".
Mary Ann Cox also testified at the inquest. Cox testified she had known Kelly for eight or nine months, and that she had last seen her alive in Dorset Street at 11:45 p.m. on 8 November, "very much intoxicated". She had been wearing a red pelerine and a shabby skirt. Cox stated she had been in the company of a short, stout and shabbily dressed man who had a pot of ale in his hand. She had not heard any sound from Kelly's room when she had returned to her own room at 5 Miller's court at 3 a.m. The next witness to testify, Elizabeth Prater, stated she had heard a "suppressed cry" of "Oh! Murder!" at approximately 3:45 a.m., although she stated such cries were commonplace in and around Spitalfields. Also to testify were witnesses Caroline Maxwell and Sarah Lewis. Maxwell testified to having seen Kelly alive on the morning of 9 November; Lewis testified to having seen a stout man in a black wideawake hat standing in the courtyard in the early hours and to hearing a woman cry "Murder!" at "nearly four".
Medical testimony
Shortly after Lewis's testimony, Phillips testified as to his examination of the body at 13 Miller's Court. He said he arrived at the crime scene at 11:45 a.m., and examined the body at 1:30 p.m. Kelly was lying "two-thirds over, towards the edge of the bedstead" and Phillips was certain the murderer had moved her body to perform the eviscerations. The initial attack had taken place as Kelly had lain on the right side of the bed, and the cause of her death was the severance of her right carotid artery. This conclusion was supported by a large quantity of blood under the bedstead and the palliasse, pillow and sheet at the top of the bed being saturated with blood. Blood spatterings on the wall on the right side of the bed in line with Kelly's neck also supported this conclusion.
Phillips estimated Kelly's death occurred between 2 a.m. and 8 a.m. Her last meal consisted of fish and potatoes, which had partly passed into her intestines, indicating she had last eaten between 10 p.m. and 11 p.m on 8 November. The superficial cut to her right thumb might have been caused while attempting to defend herself. The blade used for the mutilations was at least six inches (15cm) long and one inch (25mm) wide.
Police testimony
Following further eyewitness and character testimony from Julia Venturney and Maria Harvey, Inspectors Beck and Abberline testified about their response and examination of the crime scene. Beck testified to the orders he had given for a police surgeon to attend the scene, his efforts to retrieve evidence, and his orders forbidding any members of the public from entering Miller's Court, or for residents to leave until all had been questioned. Abberline testified Superintendent Arnold had ordered the door of Kelly's room to be forced open with a pickaxe at 1:30 p.m. He also testified as to his examination of the room, adding his opinion the extensive amount of clothing in the fireplace had been burned by Kelly's murderer to provide sufficient light for him to mutilate her body, as the sole source of light in her room had been a single candle placed on top of a broken wine glass.
Conclusion
Abberline was the last of 12 witnesses to testify at the inquest, and the hearings were completed in a single day. At the close of the hearings, Macdonald instructed the jury whether they should adjourn to hear further testimony at a later date, or close the procedures. He said: "My own opinion is that it is very unnecessary for two courts to deal with these cases, and go through the same evidence, time after time, which only causes expense and trouble. If the coroner's jury can come to a decision as to the cause of death, then that is all that they have to do ... From what I learn, the police are content to take the future conduct of the case. It is for you to say whether you will close the inquiry today; if not, we shall adjourn for a week or fortnight, to hear the evidence that you may desire."
Following a short deliberation, the jury returned a unanimous verdict: "Wilful murder against some person or persons unknown."
Kelly's death certificate was issued on 17 November. This document records her name as "Marie Jeanette Kelly" and lists her age as "about 25 years".
Investigation
Police conducted extensive house-to-house enquiries and searches. The wife of a local lodging-house deputy, Caroline Maxwell, claimed to have seen Kelly alive at about 8:30 a.m. on the morning of her murder, although she admitted to having only met Kelly on one or two previous occasions; moreover, her description did not match that of those who knew Kelly more closely. Maurice Lewis, a tailor, reported seeing Kelly at about 10 o'clock that same morning in a pub. Both statements were dismissed by the police since they did not fit the officially estimated time of death; moreover, they could find no other eyewitnesses to confirm these reports. Maxwell may have either mistaken someone else for Kelly or confused the actual day she had seen her.
On 10 November, Bond wrote a report officially linking Kelly's murder with four previous ones to occur in and around Whitechapel—those of Mary Ann Nichols, Annie Chapman, Elizabeth Stride and Catherine Eddowes. Bond also provided an offender profile of the murderer, which suggested the perpetrator was a solitary, eccentric individual who was subject to periodic attacks of homicidal and erotic mania, and who had been in an extreme state of satyriasis as he performed the mutilations upon Kelly and the four previous victims. On the same day, the Commissioner of the Metropolitan Police, Sir Charles Warren, issued a pardon for "any accomplice, not being a person who contrived or actually committed the murder, who shall give such information and evidence as shall lead to the discovery and conviction of the person or persons who committed the murder [of Mary Jane Kelly]". Despite this offer, no-one was ever charged with any of the murders.
No murders with a similar modus operandi were committed for over six months, as a result of which the police investigation into the Ripper murders was gradually wound down and press interest declined. Kelly is generally considered to have been the Ripper's final victim, and it is assumed that the crimes ended because of the culprit's death, imprisonment, institutionalisation, or emigration.
Joseph Barnett
The detective in charge of the investigation, Frederick Abberline, questioned Kelly's former partner and roommate, Joseph Barnett, for four hours after her murder. His clothes were also examined for bloodstains, but he was released without charge. Abberline's investigation appears to have completely exonerated Barnett.
A century after the murder, authors Paul Harrison and Bruce Paley proposed Barnett killed Kelly in a fit of jealous rage, possibly because she had scorned him. Harrison and Paley also suggested that he committed the previous murders to scare Kelly off the streets and away from prostitution. Other authors suggest Barnett killed Kelly only and had extensively mutilated her body to make the crime resemble a Ripper murder. The state of undress of Kelly's body, and her folded clothes on a chair, have led to suggestions that she undressed herself before lying down on the bed, which would indicate that she was either killed by someone she knew or believed to be a client.
The door to Kelly's property was locked after her murder, indicating the murderer either had possession of the key or knew how to reach through the broken windowpane to lock and unlock the door. However, the perpetrator would likely have observed Kelly reaching through the windowpane to unlock the door prior to inviting him into the room.
Other acquaintances of Kelly's put forward as her murderer include her landlord John McCarthy and her former boyfriend Joseph Fleming.
George Hutchinson
George Hutchinson only provided his eyewitness information to Sgt Edward Badham on 12 November. Inspector Abberline described Hutchinson's statement as important to the investigation. Hutchinson unsuccessfully accompanied police around Whitechapel and Spitalfields in efforts to identify this man. Hutchinson's name does not appear again in the existing police records, and so it is not possible to say with certainty whether his evidence was ultimately dismissed, disproven, or corroborated.
In his memoirs, Walter Dew discounts Hutchinson on the basis that his sighting may have been on a different day, and not the morning of the murder. Robert Anderson, head of the CID, later claimed that the only witness who got a good look at the killer was a Jew who had observed a previous victim with her murderer. Hutchinson was not a Jew, and thus not that witness. Some modern scholars have suggested that Hutchinson was the Ripper himself, trying to confuse the police with a false description, but others suggest he may have just been an attention seeker who made up a story he hoped to sell to the press.
Other theories
A small minority of modern authors consider it possible that Kelly was not a victim of the same killer as the other canonical victims of Jack the Ripper. At an assumed age of 25, Kelly was considerably younger than the other canonical victims, all of whom were in their 40s. In addition, the mutilations inflicted on Kelly were far more extensive than those on other victims. However, Kelly was also the only victim killed in the privacy of a room instead of outdoors. Her murder was separated by five weeks from the previous killings, all of which had occurred within the span of a month.
Writer Mark Daniel proposed that Kelly's murderer was a religious maniac, who killed Kelly as part of a ritual sacrifice, and that the fire in the grate was not to provide light but was used to make a burnt offering. In 1939, author William Stewart proposed that Kelly was killed by a deranged midwife, dubbed "Jill the Ripper", whom Kelly had engaged to perform an abortion. According to Stewart, the murderer had burned her own clothes in the grate because they were bloodstained and had then made her escape wearing Kelly's clothes. This, he suggested, was why Caroline Maxwell had claimed to have seen Kelly the morning of her murder, and that Maxwell had actually seen the killer dressed in Kelly's clothes. However, the medical reports, which were not available when Stewart constructed his theory, make no mention of pregnancy, and the theory is entirely based on speculation.
In 2005, author Tony Williams claimed that Mary Kelly had been found on the 1881 census return for Brymbo, near Wrexham, Wales. This claim was made on the basis that living next door to the Kelly family was a bachelor named Jonathan Davies, who could have been the "Davies" or "Davis" whom Joseph Barnett claimed had married Kelly when she was approximately 16. This claim is almost certainly wrong because if Kelly's husband was indeed killed two or three years later, this Jonathan Davies could not have been him, as the 1891 census return indicates this individual was still alive and residing in Brymbo. In any case, hardly any of the details given by Barnett matched those of the family residing in Brymbo in 1881. Brymbo is in Denbighshire, not Carmarthen or Caernarfon, and the father's name was Hubert Kelly, not John. Allegations that the diaries of Sir John Williams, on which Tony Williams based his research and whom he claims was the Ripper, were altered casts further doubt upon this author's theories. In 2015, author Wynne Weston-Davies advanced the theory that Kelly's real identity was his own great aunt Elizabeth Davies, born in 1857 as the daughter of a Welsh quarryman.
Funeral
Mary Jane Kelly was buried at 2 p.m. Monday 19 November 1888. She was laid to rest in St Patrick's Roman Catholic Cemetery in Leytonstone in a service officiated by the Reverend Father Columban.
No family members could be located to attend her funeral, and both Joseph Barnett and her landlord, John McCarthy, were insistent her remains were interred in accordance with the rituals of her Church. The eight individuals within the two mourning coaches following Kelly's polished elm and oak coffin from Shoreditch Church to the cemetery where she was buried were Joseph Barnett, an individual representing John McCarthy, and six women who had known Kelly and who had testified at the inquest into her murder: Mary Ann Cox; Elizabeth Prater; Caroline Maxwell; Sarah Lewis; Julia Venturney; and Maria Harvey. Several thousand people gathered outside Shoreditch Church to observe the funeral procession. Kelly's obituary ran as follows:
The inscription upon Kelly's grave marker reads: "In loving memory of Marie Jeanette Kelly. None but the lonely hearts can know my sadness. Love lives forever."
Media
Film
A Study in Terror (1965). This film casts Edina Ronay as Mary Jane Kelly.
Murder by Decree (1979). Directed by Bob Clark. This British-Canadian mystery thriller film casts Susan Clark as Mary Kelly.
Love Lies Bleeding (1999). A drama film directed by William Tannen. Kelly is portrayed by Andrea Miltner.
From Hell. (2001). Directed by the Hughes Brothers, the film casts Heather Graham as Mary Kelly.
Television
Jack the Ripper (1988). A Thames Television film drama series starring Michael Caine. Mary Kelly is played by Lysette Anthony.
The Real Jack the Ripper (2010). Directed by David Mortin, this series casts Yulia Petrauskas as Mary Kelly and was first broadcast on 31 August 2010.
Jack the Ripper: The Definitive Story (2011). A two-hour documentary which references original police reports and eyewitness accounts pertaining to the Whitechapel Murderer. Kelly is portrayed by Lexie Lambert.
Drama
Jack, the Last Victim (2005). This musical casts Amanda Almond as Mary Kelly.
See also
Cold case
List of serial killers before 1900
Unsolved murders in the United Kingdom
Notes
References
Bibliography
Begg, Paul (2003). Jack the Ripper: The Definitive History. London: Pearson Education.
Begg, Paul (2004). Jack the Ripper: The Facts. Barnes & Noble Books.
Bell, Neil R. A. (2016). Capturing Jack the Ripper: In the Boots of a Bobby in Victorian England. Stroud: Amberley Publishing.
Connell, Nicholas (2006). Walter Dew: The Man Who Caught Crippen. Stroud, Gloucestershire: The History Press.
Cook, Andrew (2009). Jack the Ripper. Stroud, Gloucestershire: Amberley Publishing.
Cullen, Tom (1965). Autumn of Terror. London: The Bodley Head.
Eddleston, John J. (2002). Jack the Ripper: An Encyclopedia. London: Metro Books.
Evans, Stewart P.; Rumbelow, Donald (2006). Jack the Ripper: Scotland Yard Investigates. Stroud, Gloucestershire: Sutton Publishing.
Evans, Stewart P.; Skinner, Keith (2000). The Ultimate Jack the Ripper Sourcebook: An Illustrated Encyclopedia. London: Constable and Robinson.
Evans, Stewart P.; Skinner, Keith (2001). Jack the Ripper: Letters from Hell. Stroud, Gloucestershire: Sutton Publishing.
Fido, Martin (1987). The Crimes, Detection and Death of Jack the Ripper, London: Weidenfeld and Nicolson,
Gordon, R. Michael (2000). Alias Jack the Ripper: Beyond the Usual Whitechapel Suspects. North Carolina: McFarland Publishing.
Harris, Melvin (1994). The True Face of Jack the Ripper. London: Michael O'Mara Books Ltd.
Holmes, Ronald M.; Holmes, Stephen T. (2002). Profiling Violent Crimes: An Investigative Tool. Thousand Oaks, California: Sage Publications, Inc.
Honeycombe, Gordon (1982). The Murders of the Black Museum: 1870–1970. London: Bloomsbury Books,
Lynch, Terry; Davies, David (2008). Jack the Ripper: The Whitechapel Murderer. Hertfordshire: Wordsworth Editions.
Marriott, Trevor (2005). Jack the Ripper: The 21st Century Investigation. London: John Blake.
Rumbelow, Donald (2004). The Complete Jack the Ripper: Fully Revised and Updated. London: Penguin Books.
Sugden, Philip (2002). The Complete History of Jack the Ripper. New York: Carroll & Graf Publishers.
Waddell, Bill (1993). The Black Museum: New Scotland Yard. London: Little, Brown and Company.
Whitehead, Mark; Rivett, Miriam (2006). Jack the Ripper. Harpenden, Hertfordshire: Pocket Essentials.
Whittington-Egan, Richard; Whittington-Egan, Molly (1992). The Murder Almanac. Glasgow: Neil Wilson Publishing.
Whittington-Egan, Richard (2013). Jack the Ripper: The Definitive Casebook. Stroud: Amberley Publishing.
Wilson, Colin; Odell, Robin (1987). Jack the Ripper: Summing Up and Verdict. London: Bantam Press.
Further reading
Barry, John Brooks (1975). The Michaelmas Girls. London: Deutsch.
Begg, Paul (2014). Jack the Ripper: The Forgotten Victims. London: Yale University Press.
Scott, Christopher (2005). Will the Real Mary Kelly...?. London: Adlibbed Ltd.
Weston-Davies, Wynne (2015). The Real Mary Kelly: Jack the Ripper's Fifth Victim and the Identity of the Man that Killed Her. London: Blink Publishing.
External links
18 November 1888 news article detailing the inquest into the murder of Mary Jane Kelly
22 December 1888 Evening News article pertaining to the murder of Mary Jane Kelly
2009 Daily Telegraph article detailing the victims of Jack the Ripper
BBC News article pertaining to the murders committed by Jack the Ripper
Casebook: Jack the Ripper
The Whitechapel Murder Victims: Mary Jane Kelly at whitechapeljack.com
1860s births
1880s murders in London
1888 deaths
1888 murders in the United Kingdom
19th-century Irish women
Female murder victims
Irish female prostitutes
Irish people murdered abroad
Jack the Ripper victims
Murder victims from County Limerick
November 1888 events
Women of the Victorian era |
Finishing Move Inc. are a video game music production and composer team formed by Brian Trifon and Brian Lee White. The duo has composed soundtracks for several video game titles including, The Callisto Protocol, Grounded, Borderlands 3, Microsoft Flight Simulator, Crackdown 3, Halo Wars 2, and Massive Chalice.
They won Best Original Instrumental for “Halo 2 Anniversary” at the 2015 Game Audio Network Guild (G.A.N.G.) Awards and was nominated that same year in the following categories: Music of the Year, Best Original Soundtrack Album, Best Original Vocal Song Pop, and Best Audio Mix.
In 2017, they were nominated for The Hollywood Music in Media Awards for Original Score - Video Game for their work on Halo Wars 2. The real-time strategy video game also got Trifon and White nominations for Best Interactive Score, Best Cinematic Cutscene Audio, and Best Audio Mix at the G.A.N.G. Awards in 2018.
In 2019, they were nominated for The Hollywood Music in Media Awards for Original Score - Video Game for their work on Borderlands 3.
Awards and nominations
External links
Official Website for Finishing Move Inc.
Brian Lee White on IMDb
Brian Trifon on IMDb
"Top Score: Brutal honesty brings success on 'Massive Chalice"
"How the Music to Videogame ‘Halo Wars 2’ Was Made the Old-Fashioned Way"
References
Video game musicians
Living people
Year of birth missing (living people) |
Christopher Michael Coke, also known as Dudus (born 13 March 1969), is a convicted Jamaican drug lord and the leader of the Shower Posse, a violent drug gang started by his father Lester Coke in Jamaica, which exported "large quantities" of marijuana and cocaine into the United States.
Due to their father's drug profits, Christopher and his siblings grew up amidst wealth and attended elite private schools. His sister and brother were killed in drug-related violence, in 1987 and 2004, respectively. Coke was gradually brought into his father's organization.
After his father's death in 1992, Coke, at the age of 23, became leader of the gang and the de facto authority of the Tivoli Gardens community in West Kingston. He developed community programs to help the poor and had so much local support that Jamaican police were unable to enter this neighborhood without community consent.
Coke was arrested on drug charges and extradited to the United States in 2010. His arrest had provoked violence among Coke's supporters in West Kingston. In 2011, Coke pleaded guilty to federal racketeering charges in connection with drug trafficking and assault. On 8 June 2012, he was sentenced by the United States District Court for the Southern District of New York to 23 years in federal prison.
Early life
Christopher Michael Coke was born in Kingston, Jamaica in 1969, the youngest son of Lester Lloyd Coke and Patricia Halliburton. He had an older sister and brother.
His father Lester Coke, who was also known as "Jim Brown", was the founder of a violent drug gang called the Shower Posse. Together with the gang's co-founder Vivian Blake, Lester Coke oversaw the distribution of huge amounts of cocaine and marijuana throughout Jamaica and the United States; they were blamed for more than 1000 murders in both countries during the late 1980s and early 1990s.
The gang ruled the Tivoli Gardens neighborhood of West Kingston, where the Coke family lived. Although the area had a history of extreme poverty, Coke earned immense wealth from the gang's profits and his family lived in luxury. Christopher Coke and his siblings attended school with children of the country's political elite. The family suffered from the violence associated with the competition of the drug trade and their father's activities. Coke's sister was fatally shot in 1987. Coke's brother was killed in 2004.
The United States Department of Justice indicted Lester Coke and other key members of the gang, including Vivian Blake, on drug trafficking and murder charges in 1990. Jamaican authorities arrested them. Two years after his arrest, the senior Coke died in a mysterious fire at the General Penitentiary in Kingston, where he was being held pending extradition proceedings.
Rise to power
Christopher Coke had been incorporated into his father's trusted assistants. He effectively began to rule the gang at the age of 23, after his father died. He also developed himself as a community leader in Tivoli Gardens. He distributed money to the area's poor, created employment, and set up community centers to help the children and others. He gained widespread support in the community, to the extent that Jamaican police had to seek permission from his organization before entering the neighborhood.
Extradition request and violence
In 2009 the United States first asked the Jamaican government for the extradition of Coke on drug trafficking charges.
Bruce Golding, the prime minister of Jamaica and leader of the Jamaica Labour Party, initially refused to extradite Coke. He claimed that the US had used warrantless wiretapping to gather evidence on Coke. Eavesdropping evidence precipitated the US call for extradition. On 17 May 2010, Golding relented and the government issued a warrant for Coke's arrest.
The Senator Tom Tavares-Finson withdrew as Coke's attorney on 18 May 2010 "in order to avoid conflict of interest."
Following this news, Coke's supporters began protesting and arming themselves. In late May 2010, the national government placed Kingston under a state of emergency after a series of shootings and firebombings within the city. On 24 May 2010, military and police forces launched a large-scale operation in Kingston to arrest Coke. By 27 May, at least 73 people had been killed in clashes between Jamaican security forces and gunmen in West Kingston, primarily in the neighbourhood of Tivoli Gardens. This casualty toll has climbed to a confirmed number of 76 dead victims. Mattathias Schwartz, writing for The New Yorker, reported the death toll at 74, including one soldier.
In 2013, the Government of Jamaica announced it would set up a Commission of Inquiry to investigate and report on the operation: the commission, informally known as the Tivoli Inquiry, first sat in December 2014. It is chaired by Barbados judge Sir David Simmons with Justice Hazel Harris and Professor Anthony Harriott and Velma Hylton QC.
Capture
Coke was detained during a routine roadblock while trying to reach the US Embassy in Kingston for surrender. He attempted to disguise himself as a woman, wearing a woman's wig and possessing a second one and a pair of women's sunglasses; however, the security forces recognized him through his disguise. Reverend Al Miller, an influential evangelical priest, was also detained while trying to facilitate the surrender. Miller told police Coke feared for his life if he surrendered directly to the police, and was asked for aid by Coke. Miller had previously facilitated the surrender of Coke's brother one month earlier.
Fearing for his safety, Coke voluntarily waived his right to an extradition trial so that he could be taken to the US to be tried. Coke's father had died in 1992 in a mysterious prison fire while awaiting an extradition trial in Jamaica. Coke was held under heavy guard while awaiting extradition, as the police feared an attack by his supporters.
Coke said that his decision to surrender and face charges was based on a desire to end the drug-related violence in Jamaica, to which he'd lost his sister, brother and father. He said:
"I take this decision for I now believe it to be in the best interest of my family, the community of western Kingston and in particular the people of Tivoli Gardens and above all Jamaica."
US Federal court proceedings
Coke was held at the federal New York City Metropolitan Correctional Center during the court proceedings. Coke initially pleaded not guilty to federal drug trafficking and weapons trafficking charges in May 2011. On 30 August 2011, he pleaded guilty in front of Judge Robert P. Patterson, Jr. of United States District Court for the Southern District of New York to the following charges: racketeering conspiracy for trafficking large quantities of marijuana and cocaine into the United States, and conspiracy to commit assault in aid of racketeering, for his approval of the stabbing attack of a marijuana dealer in New York City.
Initially scheduled for 8 December 2011, Judge Patterson postponed Coke's sentencing several times to provide time for Coke's defense attorneys and federal prosecutors to obtain information supporting their arguments as to the sentence. Defense attorneys cited members of Coke's family and other supporters, who portrayed him as a benevolent, philanthropic, and well-mannered individual. By contrast, federal prosecutors presented documents depicting Coke as willing to commit brutal acts of violence to support his drug empire, and implicating him in at least five murders. In one, he allegedly dismembered the victim with a chainsaw for stealing drugs from him. The Jamaican government provided evidence derived from wiretapping Coke's cellphone prior to his arrest; it had recorded at least 50,000 conversations dating back to 2004. On 8 June 2012 Coke was sentenced to 23 years in prison. He is now held at the Federal Correctional Institution, Fort Dix in Fort Dix, New Jersey with a release date of 25 January 2030. He has a register number of 02257-748.
See also
Willie Haggart
Ranking Dread
Claude Massop
References
External links
"Indictment of Christopher Coke", American Law Daily blog
"USA vs CHRISTOPHER MICHAEL COKE (1:07-cr-00971-RPP), May 22-23, 2012", Trial transcript
Mary Vallis, "Police raids reveal links to powerful Jamaican Shower Posse gang", The National Post, 4 May 2010.
Denise Balkissoon, "Deadly Shower Posse gang has deep ties to Toronto", The Toronto Star, 25 May 2010
"Critics: Rising Jamaican Death Toll Rooted in So-Called 'War on Drugs'", Democracy Now! video report, 28 May 2010
1969 births
Fugitives wanted by Jamaica
Jamaican drug traffickers
Jamaican crime bosses
Jamaican people imprisoned abroad
Living people
People extradited from Jamaica
People extradited to the United States
People from Kingston, Jamaica
Prisoners and detainees of the United States federal government
Shower Posse
Yardies |
No Limits is the fifteenth extended play (and first of original material) recorded by Puerto Rican-American rock band Boyce Avenue. It was released to digital retailers April 22, 2014 through the band's independent label 3 Peace Records. In May 2014, No Limits entered the Billboard Heatseekers Albums chart at 14.
Background and recording
In the four years since the band's last official release (2010's All We Have Left), Boyce Avenue has become the most-subscribed-to and third most-watched band on YouTube due to their popular covers of contemporary pop hits, and has been extensively touring across the globe, including opening for select dates on One Direction's Up All Night Tour. Returning to their roots of writing and producing original songs, the band began recording original material in 2013. One of these new songs, "One Life" was released in November 2013, with all proceeds from digital downloads of the song going to the charity organization Pencils of Promise.
Distributed independently through the band's 3 Peace Records after they left Universal Records in August 2011, No Limits was written, recorded, and produced by the Manzano brothers. The EP contains a more electronic and pop-influenced sound than their signature acoustic rock, including a collaboration with EDM producer Milkman. Frontman Alejandro stated in a release for their GMA appearance that the EP "showcases our experiences these past few years" and that pop music has "really inspired the direction of our music."
Promotion
The band toured Europe in March and April 2014 to promote the EP, with the original March release date pushed back to April 22, 2014. They also made an appearance on Good Morning America on April 29 to perform their single "I'll Be the One". No Limits is intended as an introduction to the new era of Boyce Avenue, with a full-length album planned for later in the year.
Singles
"One Life" was released as the official lead single from the EP on November 3, 2013. The same day, a music video for the "Collab Version" featuring over a dozen other YouTube stars premiered on YouTube. The official music video premiered December 29, 2013.
The Milkman collaboration, "I'll Be the One" was released March 23, 2014 as the second official single when it was posted to the band's official SoundCloud page. The song was performed (without Milkman) on Good Morning America.
"Speed Limit" was released as the third official single on May 18, 2014. The music video premiered on the band's official YouTube channel that day.
Critical reception
Ana Perez of The Pearl Post gave the EP a mixed review, writing that "the seven-track EP struggled to find its own voice with each song sounding strikingly similar to each other," but noted that in spite of this, "the purpose behind their music stayed strong throughout." British music blog All-Noise described the EP as a "downbeat but evocative collection of songs with a strong OneRepublic and The Script vibe"; reviewer Philip Lickley also commented on the similar-sounding songs but nevertheless rated the EP 7/10, calling it a "great EP ... definitely worth grabbing."
Track listing
Chart performance
References
2014 EPs
Boyce Avenue albums |
Alexander Seaton or Seton (before 1626 – after 1649) was a Scottish soldier in Danish service during the Thirty Years' War. He briefly served as a governor in the Battle of Stralsund and as an admiral in the Torstenson War.
Biography
Neither the place nor the date of Alexander Seaton's birth are recorded. Though his parents remain unknown, it has been proposed that either Alexander Seton of Lathrisk or George Seton of Cariston be his father.
Alexander Seaton entered the service of Christian IV of Denmark, and advanced to the rank of a captain of infantry on 8 April 1626. Upon request by the Danish king, the Scottish Privy Council allowed Seaton to levy 500 Scottish soldiers on 30 June.
On 28 February 1627, he advanced to the rank of a lieutenant colonel. In September, he was wounded in battle near Oldenburg, while securing Bernhard of Saxe-Weimar's rear against Johann Tserclaes, Count of Tilly's forces during the Battle of Heiligenhafen.
He moved his company to Stralsund where they joined other Scots of Donald Mackay's regiment during the Battle of Stralsund (1628), where he served as lieutenant colonel. He succeeded the Danish-German mercenary Heinrich Holk as Stralsund's governor. During the time he was in command, the town withstood the siege of Albrecht von Wallenstein's imperial army. He was succeeded as the governor in July by Alexander Leslie, a Scot in Swedish service who arrived with a contingent of Scots, Swedes and Germans. Wallenstein lifted the siege on 4 August, forced to accept his first check in the Thirty Years' War.
Seaton did not stay with his regiment when it entered Swedish service, and instead joined the Norwegian infantry as a captain in 1628 - having left Mackay's troops as a lieutenant colonel. For the next 17 years, no records of Seaton's life are known.
By 1645, he had advanced to the rank of a colonel in the Norwegian army and navy again. In 1645, Seaton took over eight ships of the Danish navy to fight Sweden as an admiral - the last appointment of a British in Christian IV's service. With these ships, he took part in the "Norwegian response" by attacking Gothenburg (Göteborg) from the sea. Seaton's assault took place in August, just before the Treaty of Brömsebro ended the Danish-Swedish war in favour of Sweden on 13/23 August 1645.
The last record of Seaton is of 19 April 1649, when he was a colonel in the Norwegian army. Date and place of Seaton's death are unknown, marriages are not recorded.
See also
Thirty Years' War
Battle of Stralsund (1628)
Alexander Leslie, 1st Earl of Leven
Torstenson War
Scotland and the Thirty Years' War
Notes
Sources
References
Bibliography
Steve Murdoch and Alexia Grosjean, Alexander Leslie and the Scottish Generals of the Thirty Years' War, 1618-1648 (London, 2014)
Scottish people of the Thirty Years' War
Scottish soldiers
Year of birth unknown
Year of death unknown
Scottish admirals
17th-century Scottish people
Place of birth unknown |
Mimudea dithyralis is a moth in the family Crambidae. It was described by Paul Dognin in 1910. It is found in Peru.
References
Moths described in 1910
Spilomelinae |
List of events
See also
List of massacres
Mass grave
List of riots
Notes and references |
Trinidad and Tobago–United Kingdom relations are foreign relations between Trinidad and Tobago and the United Kingdom. Both countries are full members of the Commonwealth of Nations.
History
Since the independence of Trinidad & Tobago in 1962, relations between the two countries have been mostly friendly and there are many areas in which both Trinidad and Tobago and the UK seek stronger ties for mutual benefit. There are also strong cultural and social ties between the two nations. In Trinidad and Tobago, English is one of the official languages, and Cricket is among the most popular sports. In the UK, Caribbean Carnival is hugely popular.
Economy
Trinidad and Tobago is the UK's largest export market in the Caribbean. The UK is the sixth largest supplier.
Bilateral agreements
Resident diplomatic missions
Trinidad and Tobago has a high commission in London.
United Kingdom has a high commission in Port of Spain.
See also
Trinidadian and Tobagonian British
References
External links
Bilateral relations of the United Kingdom
United Kingdom
United Kingdom and the Commonwealth of Nations
Trinidad and Tobago and the Commonwealth of Nations
Relations of colonizer and former colony |
is a passenger railway station located in the city of Kuwana, Mie Prefecture, Japan, operated by the private railway operator Yōrō Railway.
Lines
Shimo-Fukaya Station is a station on the Yōrō Line, and is located 4.0 rail kilometers from the terminus of the line at .
Station layout
The station consists of one unnumbered island platform connected to the station building by a level crossing.
Platforms
Adjacent stations
|-
!colspan=5|Yōrō Railway
History
Shimo-Fukaya Station opened on August 1, 1921 as a station on the Yōrō Railway. The Yōrō Railway became the Ise Electric Railway’s Yōrō Line on October 1, 1929, but re-emerged as the Yōrō Railway on April 20, 1936. It merged with the Sangu Electric Railway on August 1, 1940, and through a series of mergers became part of the Kansai Express Railway on June 1, 1944. The line was split off into the new Yōrō Railway on October 1, 2007.
Passenger statistics
In fiscal 2019, the station was used by an average of 562 passengers daily (boarding passengers only).
Surrounding area
Mie Prefectural Kuwana Kita High School
Kuwana City Fukaya Elementary School
See also
List of Railway Stations in Japan
References
External links
Yōrō Railway Official website
Railway stations in Japan opened in 1921
Railway stations in Mie Prefecture
Stations of Yōrō Railway
Kuwana, Mie |
Barbara Elrington Douglas Arbuthnott (12 September 1822 – 28 August 1904) was a Scottish woman who lived in Sunndal, Norway where she engaged in charitable work and wrote about her life.
Biography
Douglas was born into a wealthy Scottish family in Templemore, Ireland. Her father, Sir Neil Douglas, KCB, KCH (dies 1853) was a Scottish officer and Lieutenant General in the British army. Her mother was the daughter of a wealthy banker in Edinburgh. In her youth, she studied the Greek, Latin and German languages in Brussels (1831–1840). She met Queen Victoria in 1842. On her father's travels in the East she learned to speak Hindi.
She first married James Allen (1846–1849) who died of cholera, then Neil Ferguson, who died in the Crimean War. In London she had met the famous Norwegian violinist and theatre founder Ole Bull. She came to Sunndal, in Møre og Romsdal county, Norway on her honeymoon with her third husband (married 6 December 1865), Hon William Arbuthnott, son of 8th Viscount of Arbuthnott. They were divorced, after her 20-year-old son from her first marriage died, allegedly because she thought her husband had provoked an epileptic seizure by quarrelling with her son, who then died at Fokstua coach inn on 15 September 1868.
She was renowned, among other things, for driving her sick son with a horse and wagon across the Dovrefjell mountain range, while trying to save his life. After her son's death she bought the farm Løken, which is now a local museum.
She then cleared the land for a new farm, Elverhøy. She taught herself to speak Norwegian, cohabited with the translator, Oluf Endresen from Sunndal, and was said to be very generous, giving magnificent parties for the bourgeoisie. She took an interest in the local health service and the local rifle club, founded a local library and was an agricultural pioneer. She brought poultry and swine from Great Britain to the valley. And she wrote books about chicken farming, The Henwife (1861) and The Henwife – Her own experience in her own Poultry-Yard (1870).
She had built Alfheim, the mountain farm high up above the valley of Grødalen, in 1876. Her English bank went bankrupt in 1886. She sold some of its properties, but bankruptcy and forced sales was inevitable. She lived with the local teacher Lars Hoaas. Her board and lodging were paid for by benevolent neighbours. From 1892 to her death she lived in poverty at Einabu near the village of Grøa.
Legacy
Leikvin Cultural Heritage Park (Leikvin Bygdemuseum) has a collection from Barbara Arbuthnott's estate.
The musical Lady Arbuthnott – The mistress of Elverhøy (Lady Arbuthnott -Frua på Elverhøy), by Norwegian playwright, Stig Nilsson with music by Lars Ramsøy-Halle, has been performed annually since the Sunndal Cultural Festival (Sunndal Kulturfestival) of 1996.
The documentary film, Lady Arbuthnott – The Queen of Sunndal was shown during 1999 on the Norwegian Broadcasting Corporation.
References
Other sources
Hauge, Eiliv Odde (1957) Lady Arbuthnott og hennes menn (Gyldendal)
Selmer, Odd (1977) Barbara Arbuthnott (Gyldendal norsk Forlag)
External links
Leikvin Park of Cultural Heritage
"Sunndal si ukrona dronning, Lady Arbuthnott"
People from Møre og Romsdal
1822 births
1904 deaths
Scottish emigrants to Norway
Norwegian farmers
Scottish farmers
People from Sunndal |
Cove is an unincorporated community in South Harbor Township, Mille Lacs County, Minnesota, United States, near Onamia. The community is located along State Highway 27 (MN 27) near 100th Avenue.
References
Unincorporated communities in Mille Lacs County, Minnesota
Unincorporated communities in Minnesota |
Dielectric complex reluctance is a scalar measurement of a passive dielectric circuit (or element within that circuit) dependent on sinusoidal voltage and sinusoidal electric induction flux, and this is determined by deriving the ratio of their complex effective amplitudes. The units of dielectric complex reluctance are (inverse Farads - see Daraf) [Ref. 1-3].
As seen above, dielectric complex reluctance is a phasor represented as uppercase Z epsilon where:
and represent the voltage (complex effective amplitude)
and represent the electric induction flux (complex effective amplitude)
, lowercase z epsilon, is the real part of dielectric reluctance
The "lossless" dielectric reluctance, lowercase z epsilon, is equal to the absolute value (modulus) of the dielectric complex reluctance. The argument distinguishing the "lossy" dielectric complex reluctance from the "lossless" dielectric reluctance is equal to the natural number raised to a power equal to:
Where:
is the imaginary unit
is the phase of voltage
is the phase of electric induction flux
is the phase difference
The "lossy" dielectric complex reluctance represents a dielectric circuit element's resistance to not only electric induction flux but also to changes in electric induction flux. When applied to harmonic regimes, this formality is similar to Ohm's Law in ideal AC circuits. In dielectric circuits, a dielectric material has a dielectric complex reluctance equal to:
Where:
is the length of the circuit element
is the cross-section of the circuit element
is the complex dielectric permeability
See also
Dielectric
Dielectric reluctance — Special definition of dielectric reluctance that does not account for energy loss
References
Hippel A. R. Dielectrics and Waves. – N.Y.: JOHN WILEY, 1954.
Popov V. P. The Principles of Theory of Circuits. – M.: Higher School, 1985, 496 p. (In Russian).
Küpfmüller K. Einführung in die theoretische Elektrotechnik, Springer-Verlag, 1959.
Electric and magnetic fields in matter |
Stanley Lee (1899-1986), was an English bowls player who competed at the Commonwealth Games.
Bowls career
He participated in the 1954 British Empire and Commonwealth Games at Vancouver, British Columbia, Canada in the singles and the fours/rinks events and finishing in 8th and 10th place respectively.
Personal life
He was an electrical engineer by trade and lived in Hitchin.
References
English male bowls players
Bowls players at the 1954 British Empire and Commonwealth Games
1899 births
1986 deaths
Sportspeople from Hitchin
Commonwealth Games competitors for England |
Globidiellum is a genus of parasitic alveolates of the phylum Apicomplexa.
History
This genus was first described in 1909 by Neumann in Arnoglossus grohmanni and the sand goby (Gobius minutus) and was named Globidium. Henry in 1913 also described this genus in the haddock (Melanogrammus aeglefinus). The genus name was amended to Globidiellum by Brumpt in 1913 who noted that the Globidium was already in use
Description
Other than the original descriptions of this genus very little is known about this genus.
References
Apicomplexa genera |
John P. McDonough (May 24, 1928 – November 17, 2021) was an American Air Force officer who served as Chief of Chaplains of the United States Air Force.
Early life and education
Born in Boston, Massachusetts in 1928, McDonough was an ordained Catholic priest. He was a graduate of Saint John's Seminary.
Career
McDonough joined the United States Air Force in 1963 and was stationed at Eglin Air Force Base.
In 1982, McDonough became Command Chaplain at Headquarters, United States Air Forces in Europe. From there, he served as Command Chaplain at Headquarters, Tactical Air Command from 1984 until 1985, when he became Deputy Chief of Chaplains of the United States Air Force. He was promoted to Chief of Chaplains with the rank of major general in 1988 and held the position until his retirement in 1991.
Awards he received include the Legion of Merit, the Meritorious Service Medal with oak leaf cluster, the Air Force Commendation Medal with oak leaf cluster, the Army Commendation Medal and the Outstanding Unit Award.
After his military retirement in 1991, Msgr. McDonough was named the 12th Pastor of St. John the Baptist Parish in Peabody, Massachusetts.
Personal life
McDonough died in Boston on November 17, 2021, at the age of 93.
References
1928 births
2021 deaths
Clergy from Boston
United States Air Force generals
Chiefs of Chaplains of the United States Air Force
American Roman Catholic priests
Recipients of the Legion of Merit
Saint John's Seminary (Massachusetts) alumni |
1996 in television may refer to:
1996 in American television for television related events in the United States.
1996 in Australian television for television related events in Australia.
1996 in Belgian television for television related events in Belgium.
1996 in Brazilian television for television related events in Brazil.
1996 in British television for television related events in Great Britain.
1996 in Scottish television for television related events in Scotland.
1996 in Canadian television for television related events in Canada.
1996 in Croatian television for television related events in Croatia.
1996 in Danish television for television related events in Denmark.
1996 in Dutch television for television related events in the Netherlands.
1996 in Estonian television for television related events in Estonia.
1996 in German television for television related events in Germany.
1996 in Irish television for television related events in Ireland.
1996 in Italian television for television related events in Italy.
1996 in Japanese television for television related events in Japan.
1996 in New Zealand television for television related events in New Zealand.
1996 in Norwegian television for television related events in Norway.
1996 in Philippine television for television related events in the Philippines.
1996 in Portuguese television for television related events in Portugal.
1996 in Spanish television for television related events in Spain.
1996 in Swedish television for television related events in Sweden.
Mass media timelines by year |
The National Association of College Broadcasters (NACB), was founded in 1988 by four undergraduate students at Brown University in Providence, Rhode Island. Jumpstarted by a $300,000 grant from the now-defunct CBS Foundation, thanks to connections through the father of co-founder Doug Liman, NACB became the first trade association specifically geared to all aspects of American student-staffed radio and television stations. (Other unaffiliated organizations, such as the National Broadcasting Society, Alpha Epsilon Rho, was geared to student journalists, and not all aspects of station operations, while the Intercollegiate Broadcasting System, geared to College radio, did not embrace Student television stations until well after NACB's founding. The National Association of Educational Broadcasters was focused on professionally run stations based on college campuses that were typically National Public Radio affiliates.)
Thanks in part to keynote addresses by legendary television journalist Walter Cronkite at its first national conference in November, 1988; media magnate Ted Turner the following year; and Quincy Jones at 1990's event, NACB put itself on the map quickly, reaching a peak of over 600 member stations in the US and a few internationally by 1992. Its National College Television and Radio Awards was the second (after the Academy of Television Arts & Sciences' annual student competition) to give significant cash prizes for student productions in a wide range of programming categories that year, thanks to support from several of the US's major media companies, including CBS, ESPN, CNN, NBC, HBO, FOX, E! Entertainment, MTV Networks and Interep.
History
Over its first few years, NACB hired three full-time staff to manage the association, at times including some graduating Brown students. The association continued to enjoy significant support from student volunteers and office space on campus donated by Brown University.
Among its notable successes were U-Net (later trademarked as U Network), a satellite-delivered programming network featuring top student productions; regional conferences expanding from the national; the comprehensive Station Handbook manual, an annually updated guide for Campus radio and TV station operations; and a monthly print magazine, College Broadcaster, widely read among student managers and college station faculty advisors, published from 1989 through 1996. Unfortunately, the cost of delivering programming by satellite and the relatively few Student television station that could receive such programming at the time limited the reach of the network. In the mid-1990s, Lucie Salhany, head of the upstart television network by United Television and Paramount Pictures, made a modest unsolicited offer to buy the rights to the U Network name. NACB countered with a $100,000 request, which she refused, thus the network was named UPN instead of U.
NACB's board of directors was composed of students and faculty, most of whom turned over annually and whose business savvy was understandably not as mature as the industry professionals it attracted to its conferences. Its advisory board of media luminaries never met physically and was infrequently tapped for assistance. Incorporated as a 501(c) non-profit, its revenue streams were limited to member dues (quite low, to account for limited student organization budgets), conference registrations, database list rentals and a few special projects, so donations continued to be vital to its survival. Due primarily to a lack of seasoned leadership who could build the relationships that insured continued philanthropic support, the organization ceased operations in 1998.
Legacy
Realizing the vacuum left by NACB's demise, two of its member stations' faculty advisors (Will Robedee and Warren Kozireski) soon after founded College Broadcasters Inc., also a non-profit geared to college station operations. It continues to operate today. Fellow NACB co-founder David Bartis has continued to work closely with Doug Liman in the 20+ years since, forming a production company that has handled many major network television series as well as Doug directing major Hollywood studio feature films.
Notes:
College Broadcaster (), Providence, RI
SPIN magazine profile of NACB in May 1992 issue
BMI Supports NACB
History of Emerson College - see 1993 reference to NACB student programming awards
Hofstra University awards from NACB (in 1990s section)
Warren Kozireski biography, numerous NACB and College Broadcaster references
ACRN ranked a top student station by NACB
27th Annual and 29th Annual EVVY Awards mention NACB
KSJS-FM/San Jose references its two Station of the Year awards from NACB in 1989 and 1991 (Wayback Archive from ksjs.org/station_facts.html)
References
University and college mass media in the United States
1988 establishments in the United States |
Saint-Pierre-Montlimart () is a former commune in the Maine-et-Loire department in western France.
Geography
The commune is traversed by the Èvre river.
History
On 15 December 2015, La Boissière-sur-Èvre, Chaudron-en-Mauges, La Chaussaire, Le Fief-Sauvin, Le Fuilet, Montrevault, Le Puiset-Doré, Saint-Pierre-Montlimart, Saint-Quentin-en-Mauges, Saint-Rémy-en-Mauges and La Salle-et-Chapelle-Aubry merged becoming one commune called Montrevault-sur-Èvre.
See also
Communes of the Maine-et-Loire department
References
Saintpierremontlimart |
Antonio Rodriguez (born October 28, 1988), known as The Kensington Strangler, is an American serial killer who was convicted of raping and killing three women from November to December 2010, all of which occurred within a 10-block radius of Philadelphia's Kensington neighborhood. For his crimes, Rodriguez was sentenced to three life terms, which he is currently serving at State Correctional Institution – Rockview in Benner Township, Pennsylvania.
Murders
On November 3, 2010, the half-naked body of 21-year-old Elaine Goldberg, a nursing student at the Gwynedd Mercy University who had recently recovered from a drug addiction, was found in a parking lot on Ruth Street. Ten days later, the body of 35-year-old prostitute Nicole Piacentini, of Port Richmond, was found in similar circumstances less than a mile away from where Goldberg's body was located. While police initially claimed that there was no indication that the two murders were connected, test conducted on DNA collected from both crime scenes was later matched to the same unknown perpetrator. Upon announcing this, several other local women came forward and claimed that they had been assaulted by a stranger.
On December 15, the half-naked body of a third victim, 27-year-old Casey Mahoney of Asheville, North Carolina, was found in a patch of woods near some railroad tracks of the Kensington area. Like his previous victims, she struggled with a drug addiction from which she was trying to recover. She was dumped in isolated areas and was sexually assaulted. The similarities in the three murders started rumors that a serial killer was roaming the streets, putting pressure on the police in order to catch the assailant.
Investigation and arrest
Two days after Mahoney's murder, Philadelphia police released CCTV footage of a man suspected of assaulting a woman in Kensington on December 6, saying that the suspect could be connected to the recent murders in the area. The video showed what appeared to be a black male in his early 20s with long sideburns, who walked with a characteristic gait and supposedly said to his assault victim that his name was "Anthony".
An anonymous tip led to the arrest of a homeless vagrant, 22-year-old Antonio Rodriguez, who had been released from the Curran-Fromhold Correctional Facility on August 29, 2010, after serving a 3-month term for a felony drug charge. As a felon, he was obligated to submit his DNA into CODIS on October 25, but as the Philadelphia police had a backlog of more than 5,000 cases, they were unable to link him to the murders until January 10. Rodriguez was arrested in the kitchen of an abandoned house on January 17 by a joint team of detectives and marshals. In his subsequent confessions, Rodriguez claimed that he initially met the victims to use their services, but during the acts, he would start to choke and beat them until they eventually died. He also acknowledged that, even though he knew they were already dead, he nonetheless continued to have sex with their corpses.
The delay in his arrest caused controversy due to the time DNA processing took place, with estimates suggesting that if it had been processed fast enough, Rodriguez could have been arrested before he killed Mahoney. The backlash led to calls for some funds to be allocated to the Philadelphia Police Department, who had trouble with properly testing kits connected to violent crimes.
Trial, sentence and imprisonment
Rodriguez was soon charged with three counts of murder, and was held in prison without bond. Early, prosecutors announced that they would not seek the death penalty, citing the accused's history of mental illness and the fact that he waived his right to a jury trial. At his subsequent trial, Rodriguez's attorney attempted to bar the prosecution from presenting his client's graphic written confessions from being used in court, in addition to questioning the legitimacy of how they were obtained in the first place.
In the end, Rodriguez was found guilty on all counts and handed three consecutive life terms. One of the prosecutors, Assistant District Attorney Carlos Vega, later noted that his actions were simply "evil", citing the fact the sexual abuse Rodriguez inflicted post-mortem and him posing his victims' bodies. After his sentencing, Rodriguez was transferred to serve his sentence at State Correctional Institution – Rockview, where he remains to this day.
See also
List of serial killers in the United States
External links
"An all-out hunt for a killer" (Part 1, Part 2 and Part 3) - a three-part article on the investigation and eventual arrest of Rodriguez
Commonwealth of Pennsylvania v. Antonio Rodriguez (2012)
Inmate Locator
References
1988 births
21st-century American criminals
American male criminals
American people convicted of murder
American prisoners sentenced to life imprisonment
American rapists
American serial killers
Criminals from Philadelphia
History of Philadelphia
Living people
Necrophiles
People convicted of murder by Pennsylvania
Prisoners sentenced to life imprisonment by Pennsylvania
Serial killers from Pennsylvania
Violence against women in the United States |
Danijel Petković (, ; born on 25 May 1993) is a Montenegrin professional footballer who plays as a goalkeeper for Hungarian club Kisvárda and the Montenegro national team.
Club career
Petković started his career at Bokelj. After gaining promotion with them in 2014, he signed with FK Zeta. After one season with Zeta, he joined Lovćen on a two-year contract.
On 29 August 2016, Petković signed a three-year contract with the Hungarian team MTK Budapest. After spending one season in Hungary, he signed a three-year contract with FC Lorient in July 2017.
International career
Until 2014 he featured regularly for Montenegro U21. On 26 May 2014, he made his Montenegro debut in a 0–0 draw against Iran.
Honours
Bokelj
Montenegrin Second League: 2010-11, 2013-14
References
External links
1993 births
Living people
Sportspeople from Kotor
Men's association football goalkeepers
Montenegrin men's footballers
Montenegro men's under-21 international footballers
Montenegro men's international footballers
FK Bokelj players
FK Zeta players
FK Lovćen players
MTK Budapest FC players
FC Lorient players
Angers SCO players
Kisvárda FC players
Montenegrin Second League players
Montenegrin First League players
Nemzeti Bajnokság I players
Ligue 2 players
Ligue 1 players
Montenegrin expatriate men's footballers
Expatriate men's footballers in Hungary
Montenegrin expatriate sportspeople in Hungary
Expatriate men's footballers in France
Montenegrin expatriate sportspeople in France |
Stockwellia is a monotypic genus in the flowering plant family Myrtaceae. The sole species in the genus, Stockwellia quadrifida (commonly known as Vic Stockwell's puzzle), is endemic to Queensland.
Description
Stockwellia quadrifida is a very large rainforest emergent, growing up to tall and DBH. It has straight boles with reddish-brown flaky bark and buttress roots up to high.
The leaves are opposite to sub-opposite, glabrous, elliptic and leathery, measuring up to long by wide and turning red before falling.
Inflorescences are axillary, produced in groups of three sessile flowers on a peduncle measuring in length. The fruits are a fused woody capsule containing oval-shaped seeds measuring up to .
Discovery
This species first became known to botanical science in 1971, when Atherton resident Keith Gould began experimenting with aerial photography as a means of forestry interpretation. Some of his photos appeared to show a large group of emergent trees in a small patch of rainforest near Topaz, and he referred them to Victor (Vic) Stockwell who was Queensland Forestry's ranger responsible for managing timber harvesting in that area. Despite Stockwell's vast experience in forestry he was unable to identify the trees from the photos, and so the two men ventured on foot into the forest to find them. When they encountered the trees, Stockwell realised that this was a species unknown both to himself and to botany in general.
Stockwell was surprised to discover a tree (especially a tree so massive, and growing close to forestry roads) of which he was unaware. It quickly aroused interest in botanical circles and became known colloquially as "Vic Stockwell's Puzzle", and was even mentioned in a scientific paper as Stockwellia long before a formal description and name was published.
Distribution and habitat
This species is endemic to a very small part of the luxuriant Wet Tropics rainforests of north-eastern Queensland, specifically an area on the western slopes of Mount Bartle Frere where it is found only in well-developed rainforest. It occurs within an altitude range of about .
Taxonomy
The genus Stockwellia and the species S. quadrifida were first formally described in 2002, some thirty years after its discovery. The Australian botanists Denis John Carr, Maisie Carr and Bernard Hyland published their collaboration in the Botanical Journal of the Linnean Society, based on material collected by Hyland.
Phylogeny
Genetic studies have shown that Stockwellia belongs in the "Eucalyptopsis alliance" (along with the genera Eucalyptopsis and Allosyncarpa) and that Allosyncarpa is basal to this group while the other two are sister taxa. The closest relatives, therefore, are Eucalyptopsis alauda and Eucalyptopsis papuana (both from New Guinea and the only two species in the genus), and Allosyncarpia ternata (another monotypic genus) from the Northern Territory.
Etymology
The genus name is in honour of Vic Stockwell, being the first to identify the plant as an unknown species. The species epithet quadrifida is derived from the Latin quattuor (four), and -fidus (divided), referring to the four segments of the hypanthium.
Conservation status
This species is listed by the Queensland Department of Environment and Science as vulnerable. , it has not been assessed by the IUCN.
In the 2002 paper that formally describes S. quadrifida, the authors stated that despite its restricted range the only threat to the species is predation of the seeds by Sulphur-crested cockatoos (Cacatua galerita). However a new threat has recently appeared that may be of concern. The Australian botanist Andrew Thornhill wrote in an informal (i.e. not peer reviewed) article in The Conversation that he and fellow botanist Stuart Worboys recently visited these trees, at which time Sworboys observed evidence of the fungus myrtle rust on the leaves. Thornhill wrote: suggesting that the status of this newly discovered species may change in the future.
Ecology
The seeds are eaten by sulphur-crested cockatoos.
References
Notes
External links
View a map of historical sightings of this species at the Australasian Virtual Herbarium
View observations of this species on iNaturalist
View images of this species on Flickriver
Photographs by Don Franklin, Jan 2013.
Myrtaceae
Monotypic Myrtaceae genera
Endemic flora of Queensland
Taxa named by Maisie Carr
Taxa named by Bernard Hyland |
Antonín Dvořák's String Quartet No. 8. in E major, Op. 80 (B. 57), is a chamber composition, written between 20 January and 4 February 1876 in Prague.
The work, originally marked as Op. 27, was composed shortly after finishing the Piano Trio in G minor, Op. 26, and before the beginning of the sketchings for the Stabat Mater cantata.
The quartet was published in 1888 by Fritz Simrock in Berlin as Op. 80, although Dvořák protested. The first performance took place on 29 December 1890 at the concert of the Joachim Quartet in Berlin, played by Joachim, Hegemeister, Wirth and Diepert.
Structure
The composition consists of four movements:
The recent loss of Dvořák's second child is apparent in his works from this period. The quartet, like the Stabat Mater and Piano Trio No. 2, is sad and nostalgic. Although nominally in a major key, themes are often presented in a minor key. The expression of melancholy and sorrow is apparent throughout the work.
A typical performance lasts about 28 minutes.
Recordings
Dvořák: Chamber Works Vol. 6. CD Supraphon. 11 1456-2 131. (Panocha Quartet)
Footnotes
References
Antonín Dvořák: Smyčcový kvartet E dur, Op. 80. (Score) Prague: SNKLHU, 1956. H 1835
External links
String Quartet No. 8 on a comprehensive Dvorak site
Dvorak 08
1876 compositions
Compositions in E major |
Martin Jetter (born 1959 in Germany), is a computer engineer and businessman. He studied at University of Stuttgart and received a master's degree in mechanical engineering from the same university.
Career
Jetter started to work for IBM Deutschland GmbH as an application engineer in 1986. He became a manager of the industrial sector of IBM Central Europe in 1999, and a director in charge of Siemens Group in 2001. He was promoted to CEO of IBM Deutschland in 2006, and an IBM Corporate Director of Strategy in 2011. In 2012, he became CEO of IBM Japan, Ltd.
In January 2015, he became the senior vice president of IBM Global Technology Services.
In February 2019, he became the senior vice president and chairman of IBM Europe.
References
External links
Martin Jetter: Executive Profile & Biography – Bloomberg Businessweek
1959 births
Living people
IBM employees
American business executives
German business executives
Japanese business executives |
Jochen Carow (born February 10, 1944) is a German former footballer.
External links
1944 births
Living people
German men's footballers
East German men's footballers
East Germany men's international footballers
Berliner FC Dynamo players
DDR-Oberliga players
Men's association football defenders |
The Very Best of Andy Williams is a compilation album by American pop singer Andy Williams that was released in the UK on October 5, 2009. A note from Williams inside the CD booklet explains that the album "was put together to coincide with my memoir Moon River and Me, published by Orion Press. It includes many of the songs that you made hits. I truly appreciate that, and I hope you enjoy the songs we selected for this CD." This compilation includes recordings that either charted in the UK but not in the US ("Can't Take My Eyes off You", "It's So Easy", "May Each Day") or charted much higher on the UK singles chart than they did on the Billboard Hot 100 in the US ("Almost There", "Can't Help Falling in Love"). It entered the UK albums chart on October 17, 2009, and reached number 10 during its six weeks there.
On July 22, 2013, the British Phonographic Industry awarded the album with Gold certification for sales of 100,000 units.
An 18-track compilation album released in conjunction with the book publication in the US was titled Moon River: The Very Best of Andy Williams and had the same cover photo and design but had only nine of the 24 tracks on this album in common.
Track listing
"Moon River" (Henry Mancini, Johnny Mercer) – 2:46
recorded on 1/4/62 for his album Moon River and Other Great Movie Themes
"Can't Get Used to Losing You" (Jerome "Doc" Pomus, Mort Shuman) – 2:25
rec. 12/2/62; UK singles chart: #2 (1 week)
"Music to Watch Girls By" (Sid Ramin, Tony Velona) – 2:38
rec. 2/21/67; UK singles chart: #33
"Can't Take My Eyes Off You" (Bob Crewe, Bob Gaudio) – 3:15
rec. 9/18/67; UK singles chart: #5
"The Impossible Dream (The Quest)" from Man of La Mancha (Joe Darion, Mitch Leigh) – 2:39
rec. 1968 for his album Honey
"Happy Heart" (James Last, Jackie Rae) – 3:15
rec. 3/8/69; UK singles chart: #19
"Solitaire" (Phil Cody, Neil Sedaka) – 4:22
rec. 7/73; UK singles chart: #4
"Never Can Say Goodbye" (Clifton Davis) – 3:33
rec. 4/22/71 for his album You've Got a Friend
"Raindrops Keep Fallin' on My Head" (Burt Bacharach, Hal David) – 3:11
rec. 2/24/70 for his album Raindrops Keep Fallin' on My Head
"It's So Easy" (Dor Lee, Dave Watkins) – 2:29
rec. 1/14/70 & 1/16/70; UK singles chart: #13
"Born Free" (John Barry, Don Black) – 2:27
rec. 3/2/67 for his album Born Free
"Up, Up and Away" (Jimmy Webb) – 2:36
rec. 1968 for his album Honey
"Home Lovin' Man" (Roger Cook, Roger Greenaway, Tony Macaulay) – 3:10
rec. 8/29/70; UK singles chart: #7
"Can't Help Falling in Love" (George Weiss, Hugo Peretti, Luigi Creatore) – 3:15
rec. 1/14/70; UK singles chart: #3
"MacArthur Park" (Jimmy Webb) – 5:03
rec. 1/4/71 for his album Love Theme from 'The Godfather'
"We've Only Just Begun" (Roger Nichols, Paul Williams) – 3:15
rec. 12/7/70 for his album Love Story
"Almost There" (Jerry Keller, Gloria Shayne) – 2:59
rec. 2/28/64; UK singles chart: #2 (3 weeks)
"Abraham, Martin and John" (Dick Holler) – 3:43
rec. 1969 for his album Happy Heart
"(Where Do I Begin) Love Story" (Francis Lai, Carl Sigman) – 3:10
rec. 12/17/70; UK singles chart: #4
"Ave Maria" performed with the St. Charles Borromeo Choir (Franz Schubert) – 4:55
rec. 7/17/68; B-side of "Battle Hymn of the Republic" (1968)
"The Look of Love" (Burt Bacharach, Hal David) – 2:55
rec. 1967 for his album Love, Andy
"May Each Day" (Mort Green, George Wyle) – 2:54
rec. 1/16/63; UK singles chart: #19 (1966)
"Somethin' Stupid" (C. Carson Parks) – 2:59
rec. 1967 for his album Love, Andy
"It's the Most Wonderful Time of the Year" (Edward Pola, George Wyle) – 2:32
rec. 9/12/63 for The Andy Williams Christmas Album
Personnel
Artie Butler – arranger ("Home Lovin' Man", "MacArthur Park", "We've Only Just Begun")
Al Capps – arranger ("Abraham, Martin and John", "Can't Help Falling in Love", "Happy Heart", "It's So Easy"), arranger/conductor ("Raindrops Keep Fallin' on My Head")
Nick DeCaro – arranger/producer ("Born Free", "Can't Take My Eyes Off You", "The Impossible Dream (The Quest)", "The Look of Love", "Music to Watch Girls By", "Somethin' Stupid", "Up, Up and Away")
Ernie Freeman – arranger ("Never Can Say Goodbye")
Jerry Fuller – producer ("Abraham, Martin and John", "Happy Heart")
Dick Glasser – producer ("Can't Help Falling in Love", "Home Lovin' Man", "It's So Easy", "Love Story", "MacArthur Park", "Never Can Say Goodbye", "Raindrops Keep Fallin' on My Head", "We've Only Just Begun")
Dick Hazard – arranger ("Love Story")
Eddie Karam – conductor ("Can't Take My Eyes Off You", "The Look of Love", "Somethin' Stupid")
Johnny Mandel – arranger ("It's the Most Wonderful Time of the Year")
Robert Mersey – arranger/conductor/producer ("Almost There", "Can't Get Used to Losing You", "May Each Day", "Moon River"), conductor/producer ("It's the Most Wonderful Time of the Year")
Richard Perry – producer ("Solitaire")
The St. Charles Borromeo Choir – background vocals ("Ave Maria")
Andy Williams – producer ("Ave Maria"); vocalist
References
Bibliography
2009 compilation albums
Andy Williams compilation albums
Columbia Records compilation albums |
```javascript
import React, { Component } from 'react';
import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import editorStyles from './editorStyles.module.css';
import hashtagStyles from './hashtagStyles.module.css';
const hashtagPlugin = createHashtagPlugin({ theme: hashtagStyles });
const plugins = [hashtagPlugin];
const text =
'In this editor, we can even apply our own styles #design #theme';
export default class CustomHashtagEditor extends Component {
state = {
editorState: createEditorStateWithText(text),
};
onChange = (editorState) => {
this.setState({
editorState,
});
};
focus = () => {
this.editor.focus();
};
render() {
return (
<div className={editorStyles.editor} onClick={this.focus}>
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
plugins={plugins}
ref={(element) => {
this.editor = element;
}}
/>
</div>
);
}
}
``` |
In theoretical physics, supersymmetric quantum mechanics is an area of research where supersymmetry are applied to the simpler setting of plain quantum mechanics, rather than quantum field theory. Supersymmetric quantum mechanics has found applications outside of high-energy physics, such as providing new methods to solve quantum mechanical problems, providing useful extensions to the WKB approximation, and statistical mechanics.
Introduction
Understanding the consequences of supersymmetry (SUSY) has proven mathematically daunting, and it has likewise been difficult to develop theories that could account for symmetry breaking, i.e., the lack of observed partner particles of equal mass. To make progress on these problems, physicists developed supersymmetric quantum mechanics, an application of the supersymmetry superalgebra to quantum mechanics as opposed to quantum field theory. It was hoped that studying SUSY's consequences in this simpler setting would lead to new understanding; remarkably, the effort created new areas of research in quantum mechanics itself.
For example, students are typically taught to "solve" the hydrogen atom by a laborious process which begins by inserting the Coulomb potential into the Schrödinger equation. After a considerable amount of work using many differential equations, the analysis produces a recursion relation for the Laguerre polynomials. The final outcome is the spectrum of hydrogen-atom energy states (labeled by quantum numbers n and l). Using ideas drawn from SUSY, the final result can be derived with significantly greater ease, in much the same way that operator methods are used to solve the harmonic oscillator. A similar supersymmetric approach can also be used to more accurately find the hydrogen spectrum using the Dirac equation. Oddly enough, this approach is analogous to the way Erwin Schrödinger first solved the hydrogen atom. Of course, he did not call his solution supersymmetric, as SUSY was thirty years in the future.
The SUSY solution of the hydrogen atom is only one example of the very general class of solutions which SUSY provides to shape-invariant potentials, a category which includes most potentials taught in introductory quantum mechanics courses.
SUSY quantum mechanics involves pairs of Hamiltonians which share a particular mathematical relationship, which are called partner Hamiltonians. (The potential energy terms which occur in the Hamiltonians are then called partner potentials.) An introductory theorem shows that for every eigenstate of one Hamiltonian, its partner Hamiltonian has a corresponding eigenstate with the same energy (except possibly for zero energy eigenstates). This fact can be exploited to deduce many properties of the eigenstate spectrum. It is analogous to the original description of SUSY, which referred to bosons and fermions. We can imagine a "bosonic Hamiltonian", whose eigenstates are the various bosons of our theory. The SUSY partner of this Hamiltonian would be "fermionic", and its eigenstates would be the theory's fermions. Each boson would have a fermionic partner of equal energy—but, in the relativistic world, energy and mass are interchangeable, so we can just as easily say that the partner particles have equal mass.
SUSY concepts have provided useful extensions to the WKB approximation in the form of a modified version of the Bohr-Sommerfeld quantization condition. In addition, SUSY has been applied to non-quantum statistical mechanics through the Fokker–Planck equation, showing that even if the original inspiration in high-energy particle physics turns out to be a blind alley, its investigation has brought about many useful benefits.
Example: the harmonic oscillator
The Schrödinger equation for the harmonic oscillator takes the form
where is the th energy eigenstate of with energy . We want to find an expression for in terms of . We define the operators
and
where , which we need to choose, is called the superpotential of . We also define the aforementioned partner Hamiltonians and as
A zero energy ground state of would satisfy the equation
Assuming that we know the ground state of the harmonic oscillator , we can solve for as
We then find that
We can now see that
This is a special case of shape invariance, discussed below. Taking without proof the introductory theorem mentioned above, it is apparent that the spectrum of will start with and continue upwards in steps of The spectra of and will have the same even spacing, but will be shifted up by amounts and , respectively. It follows that the spectrum of is therefore the familiar .
The SUSY QM superalgebra
In fundamental quantum mechanics, we learn that an algebra of operators is defined by commutation relations among those operators. For example, the canonical operators of position and momentum have the commutator . (Here, we use "natural units" where Planck's constant is set equal to 1.) A more intricate case is the algebra of angular momentum operators; these quantities are closely connected to the rotational symmetries of three-dimensional space. To generalize this concept, we define an anticommutator, which relates operators the same way as an ordinary commutator, but with the opposite sign:
If operators are related by anticommutators as well as commutators, we say they are part of a Lie superalgebra. Let's say we have a quantum system described by a Hamiltonian and a set of operators . We shall call this system supersymmetric if the following anticommutation relation is valid for all :
If this is the case, then we call the system's supercharges.
Example
Let's look at the example of a one-dimensional nonrelativistic particle with a 2D (i.e., two states) internal degree of freedom called "spin" (it's not really spin because "real" spin is a property of 3D particles). Let be an operator which transforms a "spin up" particle into a "spin down" particle. Its adjoint then transforms a spin down particle into a spin up particle; the operators are normalized such that the anticommutator . And of course, . Let be the momentum of the particle and be its position with . Let (the "superpotential") be an arbitrary complex analytic function of and define the supersymmetric operators
Note that and are self-adjoint. Let the Hamiltonian
where W' is the derivative of W. Also note that {Q1,Q2}=0. This is nothing other than N = 2 supersymmetry. Note that acts like an electromagnetic vector potential.
Let's also call the spin down state "bosonic" and the spin up state "fermionic". This is only in analogy to quantum field theory and should not be taken literally. Then, Q1 and Q2 maps "bosonic" states into "fermionic" states and vice versa.
Let's reformulate this a bit:
Define
and of course,
and
An operator is "bosonic" if it maps "bosonic" states to "bosonic" states and "fermionic" states to "fermionic" states. An operator is "fermionic" if it maps "bosonic" states to "fermionic" states and vice versa. Any operator can be expressed uniquely as the sum of a bosonic operator and a fermionic operator. Define the supercommutator [,} as follows: Between two bosonic operators or a bosonic and a fermionic operator, it is none other than the commutator but between two fermionic operators, it is an anticommutator.
Then, x and p are bosonic operators and b, , Q and are fermionic operators.
Let's work in the Heisenberg picture where x, b and are functions of time.
Then,
This is nonlinear in general: i.e., x(t), b(t) and do not form a linear SUSY representation because isn't necessarily linear in x. To avoid this problem, define the self-adjoint operator . Then,
and we see that we have a linear SUSY representation.
Now let's introduce two "formal" quantities, ; and with the latter being the adjoint of the former such that
and both of them commute with bosonic operators but anticommute with fermionic ones.
Next, we define a construct called a superfield:
f is self-adjoint, of course. Then,
Incidentally, there's also a U(1)R symmetry, with p and x and W having zero R-charges and having an R-charge of 1 and b having an R-charge of -1.
Shape invariance
Suppose is real for all real . Then we can simplify the expression for the Hamiltonian to
There are certain classes of superpotentials such that both the bosonic and fermionic Hamiltonians have similar forms. Specifically
where the 's are parameters. For example, the hydrogen atom potential with angular momentum can be written this way.
This corresponds to for the superpotential
This is the potential for angular momentum shifted by a constant. After solving the ground state, the supersymmetric operators can be used to construct the rest of the bound state spectrum.
In general, since and are partner potentials, they share the same energy spectrum except the one extra ground energy. We can continue this process of finding partner potentials with the shape invariance condition, giving the following formula for the energy levels in terms of the parameters of the potential
where are the parameters for the multiple partnered potentials.
Applications
In 2021, supersymmetric quantum mechanics was applied to option pricing and the analysis of markets in quantum finance, and to financial networks.
See also
Supersymmetry algebra
Superalgebra
Supersymmetric gauge theory
References
Sources
F. Cooper, A. Khare and U. Sukhatme, "Supersymmetry and Quantum Mechanics", Phys.Rept.251:267-385, 1995.
D.S. Kulshreshtha, J.Q. Liang and H.J.W. Muller-Kirsten, "Fluctuation equations about classical field configurations and supersymmetric quantum mechanics", Annals Phys. 225:191-211, 1993.
G. Junker, "Supersymmetric Methods in Quantum and Statistical Physics", Springer-Verlag, Berlin, 1996
B. Mielnik and O. Rosas-Ortiz, "Factorization: Little or great algorithm?", J. Phys. A: Math. Gen. 37: 10007-10035, 2004
External links
References from INSPIRE-HEP
Quantum mechanics
Supersymmetry |
Mount Dutton Bay is a coastal locality in the Eyre and Western region of South Australia, situated in the District Council of Lower Eyre Peninsula. The name and boundaries were formalised in October 2003 in respect of the long established local name which is derived from the body of water known as Mount Dutton Bay. The locality incorporates three older residential "shack sites": Mount Dutton Bay West, on Dolphin Drive, Mount Dutton Bay East, on Woolshed Drive, and Shelley Beach/Salt Creek, on Shelly Beach Road. It is part of the cadastral Hundred of Lake Wangary.
The historic Mount Dutton Bay Woolshed and Mount Dutton Bay Jetty are listed on the South Australian Heritage Register. The woolshed and jetty were built by Eyre Peninsula pastoral pioneer Price Maurice to shear wool from his pastoral leases and transport it to markets; the jetty, the latter of the two, dates from 1881. The site was used as a hub for the wool industry until the 1950s; it has continued as a base for leisure activities thereafter. The woolshed and adjacent shearers' quarters now house tourist accommodation, a museum, cafe and gallery; a caravan park has also been built alongside.
The Mount Dutton Bay Conservation Park is located on islands in Mount Dutton Bay and other adjoining bodies of water.
The Aboriginal Barngarla name for "Mount Dutton" is Miranda.
References
Eyre Peninsula
Towns in South Australia |
Dar Parusheh (, also Romanized as Dār Parūsheh and Dārparūsheh; also known as Dāl Parūsheh and Do Āb) is a village in Helilan Rural District, Helilan District, Chardavol County, Ilam Province, Iran. At the 2006 census, its population was 323, in 63 families. The village is populated by Kurds.
References
Populated places in Chardavol County
Kurdish settlements in Ilam Province |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.