/// <summary> /// Adds the RatingItem to the collection of selected items. /// </summary> /// <remarks> /// This API supports the .NET Framework infrastructure and is not /// intended to be used directly from your code. /// </remarks> void ISelectionItemProvider.AddToSelection() { RatingItem owner = OwnerRatingItem; Controls.Rating parent = owner.ParentRating; if (parent == null || parent.Value != null) { throw new InvalidOperationException(global::System.Windows.Controls.Properties.Resources.Automation_OperationCannotBePerformed); } owner.SelectValue(); }
/// <summary> /// Removes the current Rating from the collection of selected /// items. /// </summary> /// <remarks> /// This API supports the .NET Framework infrastructure and is not /// intended to be used directly from your code. /// </remarks> void ISelectionItemProvider.RemoveFromSelection() { RatingItem owner = OwnerRatingItem; Controls.Rating parent = owner.ParentRating; if (parent == null) { throw new InvalidOperationException(global::System.Windows.Controls.Properties.Resources.Automation_OperationCannotBePerformed); } if (!parent.IsReadOnly) { parent.Value = null; } }
protected override List <AutomationPeer> GetChildrenCore() { Controls.Rating owner = OwnerRating; ItemCollection items = owner.Items; if (items.Count <= 0) { return(null); } List <AutomationPeer> peers = new List <AutomationPeer>(items.Count); for (int i = 0; i < items.Count; i++) { RatingItem element = owner.ItemContainerGenerator.ContainerFromIndex(i) as RatingItem; if (element != null) { peers.Add(FromElement(element) ?? CreatePeerForElement(element)); } } return(peers); }
/// <summary> /// Initializes a new instance of the <see cref="RatingAutomationPeer"/> class. /// </summary> /// <param name="owner">The Rating that is associated with this /// RatingAutomationPeer.</param> public RatingAutomationPeer(Controls.Rating owner) : base(owner) { }