Beispiel #1
0
		public static sw.FrameworkElementFactory EditableBlock(swd.RelativeSource relativeSource)
		{
			var factory = new sw.FrameworkElementFactory(typeof(EditableTextBlock));
			var binding = new sw.Data.Binding { Path = TextPath, RelativeSource = relativeSource, Mode = swd.BindingMode.TwoWay, UpdateSourceTrigger = swd.UpdateSourceTrigger.PropertyChanged };
			factory.SetBinding(EditableTextBlock.TextProperty, binding);
			return factory;
		}
Beispiel #2
0
		public static sw.FrameworkElementFactory TextBlock(bool setMargin = true)
		{
			var factory = new sw.FrameworkElementFactory(typeof(swc.TextBlock));
			factory.SetBinding(swc.TextBlock.TextProperty, new sw.Data.Binding { Path = TextPath });
			if (setMargin)
				factory.SetValue(sw.FrameworkElement.MarginProperty, new sw.Thickness(2));
			return factory;
		}
Beispiel #3
0
		public static sw.FrameworkElementFactory ItemTemplate(bool editable, swd.RelativeSource relativeSource = null)
		{
			var factory = new sw.FrameworkElementFactory(typeof(swc.StackPanel));
			factory.SetValue(swc.StackPanel.OrientationProperty, swc.Orientation.Horizontal);
			factory.AppendChild(ImageBlock());
			factory.AppendChild(editable ? EditableBlock(relativeSource) : TextBlock());
			return factory;
		}
Beispiel #4
0
        public static sw.FrameworkElementFactory ItemTemplate(bool editable, swd.RelativeSource relativeSource = null)
        {
            var factory = new sw.FrameworkElementFactory(typeof(swc.StackPanel));

            factory.SetValue(swc.StackPanel.OrientationProperty, swc.Orientation.Horizontal);
            factory.AppendChild(ImageBlock());
            factory.AppendChild(editable ? EditableBlock(relativeSource) : TextBlock());
            return(factory);
        }
Beispiel #5
0
		public static sw.FrameworkElementFactory ImageBlock()
		{
			var factory = new sw.FrameworkElementFactory(typeof(swc.Image));
			factory.SetValue(sw.FrameworkElement.MaxHeightProperty, 16.0);
			factory.SetValue(sw.FrameworkElement.MaxWidthProperty, 16.0);
			factory.SetValue(swc.Image.StretchDirectionProperty, swc.StretchDirection.DownOnly);
			factory.SetValue(sw.FrameworkElement.MarginProperty, new sw.Thickness(0, 2, 2, 2));
			factory.SetBinding(swc.Image.SourceProperty, new sw.Data.Binding { Converter = new ImageConverter() });
			return factory;
		}
Beispiel #6
0
        public static sw.FrameworkElementFactory EditableBlock(swd.RelativeSource relativeSource)
        {
            var factory = new sw.FrameworkElementFactory(typeof(EditableTextBlock));
            var binding = new sw.Data.Binding {
                Path = TextPath, RelativeSource = relativeSource, Mode = swd.BindingMode.TwoWay, UpdateSourceTrigger = swd.UpdateSourceTrigger.PropertyChanged
            };

            factory.SetBinding(EditableTextBlock.TextProperty, binding);
            return(factory);
        }
Beispiel #7
0
        public static sw.FrameworkElementFactory ImageBlock()
        {
            var factory = new sw.FrameworkElementFactory(typeof(swc.Image));

            factory.SetValue(sw.FrameworkElement.MaxHeightProperty, 16.0);
            factory.SetValue(sw.FrameworkElement.MaxWidthProperty, 16.0);
            factory.SetValue(swc.Image.StretchDirectionProperty, swc.StretchDirection.DownOnly);
            factory.SetValue(sw.FrameworkElement.MarginProperty, new sw.Thickness(0, 2, 2, 2));
            factory.SetBinding(swc.Image.SourceProperty, new sw.Data.Binding {
                Converter = new ImageConverter()
            });
            return(factory);
        }
Beispiel #8
0
        public static sw.FrameworkElementFactory TextBlock(bool setMargin = true)
        {
            var factory = new sw.FrameworkElementFactory(typeof(swc.TextBlock));

            factory.SetBinding(swc.TextBlock.TextProperty, new sw.Data.Binding {
                Path = TextPath
            });
            if (setMargin)
            {
                factory.SetValue(sw.FrameworkElement.MarginProperty, new sw.Thickness(2));
            }
            return(factory);
        }