Exemple #1
0
        /// <summary>
        /// Handles visibility changing of framework elements.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private static void frameworkElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement elem = sender as FrameworkElement;

            if (elem.IsVisible)
            {
                ObjectDataProvider provider = ((sender as FrameworkElement).Resources["Resources"] as ObjectDataProvider);
                provider.Refresh();
                CultureResources.registerDataProvider(provider);
            }
        }
Exemple #2
0
        /// <summary>
        /// Handles loading of a framework element.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private static void FrameworkElement_Loaded(object sender, RoutedEventArgs e)
        {
            FrameworkElement elem = sender as FrameworkElement;

            if (elem.IsVisible == false)
            {
                // don't register the provider if this element is not visible. The problem is the element is never unloaded unless it is made
                // visible first. The visibility handler will register the provider when the element becomes visible.
                return;
            }
            ObjectDataProvider provider = (elem.Resources["Resources"] as ObjectDataProvider);

            provider.Refresh();
            CultureResources.registerDataProvider(provider);
        }
Exemple #3
0
        /// <summary>
        /// Handles unloading of a framework element.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private static void FrameworkElement_Unloaded(object sender, RoutedEventArgs e)
        {
            ObjectDataProvider provider = ((sender as FrameworkElement).Resources["Resources"] as ObjectDataProvider);

            CultureResources.deregisterDataProvider(provider);
        }