Example #1
0
        private static void OnSelectedItem_PropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LolloListChooser me = obj as LolloListChooser;

            if (me == null)
            {
                return;
            }

            if (e?.NewValue is TextAndTag)
            {
                me.MyTextBlock.Text = (e.NewValue as TextAndTag).Text;
                for (int i = 0; i < me.ItemsSource.Count; i++)
                {
                    if (me.ItemsSource[i].Text == (e.NewValue as TextAndTag).Text)
                    {
                        me.SelectedIndex = i;
                        break;
                    }
                }
            }
            else
            {
                me.MyTextBlock.Text = me.PlaceholderText;
            }
        }
Example #2
0
        private static void OnText_PropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LolloListChooser me       = obj as LolloListChooser;
            string           newValue = e.NewValue as string;

            if (me != null)
            {
                me.MyTextBlock.Text = newValue ?? me.PlaceholderText;
            }
        }
Example #3
0
        private static void OnPlaceholderText_PropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LolloListChooser me = obj as LolloListChooser;

            if (me == null)
            {
                return;
            }

            string newValue = e.NewValue as string;

            if (string.IsNullOrEmpty(me.Text))
            {
                me.MyTextBlock.Text = newValue ?? string.Empty;
            }
        }