Ejemplo n.º 1
0
        /// <summary>
        /// Finds the view associated with the given parameter.
        /// </summary>
        /// <param name="region">The region.</param>
        /// <param name="parameter">The parameter.</param>
        /// <returns>The view that is associated with the given parameter.</returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="region"/> is <see langword="null" />.
        /// </exception>
        public static object GetViewByParameter(this IRegion region, Parameter parameter)
        {
            {
                Lokad.Enforce.Argument(() => region);
            }

            return region.Views.OfType<DependencyObject>().FirstOrDefault(x => parameter.Equals(GetParameter(x)));
        }