Ejemplo n.º 1
0
        private static void OnTitleObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            string text = args.NewValue as string;

            if (text == null)
            {
                text = string.Empty;
            }
            InfoBox infobox = (InfoBox)obj;

            infobox.textBlockTitle.Text = text;
            if (infobox.autoHideIfEmpty)
            {
                if (string.IsNullOrEmpty(infobox.textBlockTitle.Text) && string.IsNullOrEmpty(infobox.textBlockContent.Text))
                {
                    infobox.Visibility = Visibility.Collapsed;
                }
                else
                {
                    infobox.Visibility = Visibility.Visible;
                }
            }
        }