Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Change FORMAT of DateTimeUpDown in PropertyGrid

$
0
0
I could not get this to work with XAML at all. But the following C# code seems to work, but should it really be this difficult! I don't know how to code the

Value="{Binding Value}"

though
            var tp = new List<TargetPropertyType>();

            tp.Add(new TargetPropertyType()
            {
                Type = typeof(Nullable<DateTime>)
            });

            var et = new DataTemplate()
            {
                DataType = typeof(Xceed.Wpf.Toolkit.DateTimePicker)
            };

            et.VisualTree = new FrameworkElementFactory(typeof(Xceed.Wpf.Toolkit.DateTimePicker));

            et.VisualTree.SetValue(Xceed.Wpf.Toolkit.DateTimePicker.FormatProperty, Xceed.Wpf.Toolkit.DateTimeFormat.ShortDate);
            et.Seal();

            this.propertyGridOut.EditorDefinitions.Add(
                new EditorTemplateDefinition()
                {
                    TargetProperties = tp,
                    EditingTemplate = et
                });

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>