PointControl color

Jul 14, 2010 at 12:40 PM
How can i alter the color of the PointControl ?
Developer
Jul 14, 2010 at 1:00 PM

you can update the colour in the Themes/Generic.xaml file 
you will find the template for the Point control and change the colours or whatever else you want to change, shape, stroke whatever 

Jul 14, 2010 at 1:05 PM
Yes i figured that out but then the color changes for all points i want to be able to change the color of the Stroke and Fill from code so i can have some that are green an some that are yellow
Developer
Jul 14, 2010 at 1:15 PM

 

http://deepearth.codeplex.com/workitem/6967

do what this guy says, i will do it later, i have not had time yet

Jul 14, 2010 at 1:40 PM
Sorry i don't know how to do that i have no experience with template controls, think it all is a little bit confusing and unflexible i will wait until somebody else can do it
Jul 14, 2010 at 2:10 PM
ok forget it i have figured it out
Jun 15, 2011 at 3:13 PM

So how did you fix it?

Jun 15, 2011 at 9:45 PM

 

uhhh it is so long ago i have done anything with deepearth
first you have to change the template 
Map/DeepEarth.Map/Themes/generic.xaml
 <Grid.RenderTransform>
                             <CompositeTransform x:Name="PART_CompositeTransform" />
                         </Grid.RenderTransform>
-                        <Ellipse Height="15" Width="15" Fill="Yellow" Stroke="RoyalBlue" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <Ellipse Height="15" Width="15" x:Name="PART_PointElipse" Fill="Yellow" Stroke="RoyalBlue" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Grid>

                         

Index: Map/DeepEarth.Map/Geometries/PointControl.cs
===================================================================
--- Map/DeepEarth.Map/Geometries/PointControl.cs	(revision 47663)
+++ Map/DeepEarth.Map/Geometries/PointControl.cs	(working copy)
@@ -5,6 +5,7 @@
 using System.Windows;
 using System.Windows.Media;
 using GeoAPI.Geometries;
+using System.Windows.Shapes;
 
 namespace DeepEarth.Client.MapControl.Geometries
 {
@@ -13,8 +14,10 @@
     {
         private const string PART_CompositeTransform = "PART_CompositeTransform";
         private CompositeTransform _compositeTransform;
-
+        private Ellipse _ellipse;
         private Point _logicalCoordinate;
+        private Brush _stroke;
+        private Brush _fill;
 
         /// 
         /// The System.Windows.Point class
@@ -53,6 +56,7 @@
         {
             DefaultStyleKey = typeof(PointControl);
             _logicalCoordinate = new Point();
+            
         }
 
         public override void OnApplyTemplate()
@@ -60,9 +64,14 @@
             base.OnApplyTemplate();
 
             _compositeTransform = (CompositeTransform)GetTemplateChild(PART_CompositeTransform);
+            _ellipse = (Ellipse)GetTemplateChild("PART_PointElipse");
+            if(_stroke != null)
+            _ellipse.Stroke = _stroke;
+            if (_fill != null)
+                _ellipse.Fill = _fill;
+                    
             _compositeTransform.CenterX = Anchor.X;
             _compositeTransform.CenterY = Anchor.Y;
-
             IsLoaded = true;
             ForceMeasure();
 
@@ -71,7 +80,34 @@
                 Layer.UpdateChildLocation(this);
             }
         }

+        public Brush Stroke
+        {
+            get { return _stroke; }
+            set
+            {
+                _stroke = value;
+                if (IsLoaded)
+                {
+                    _ellipse.Stroke = _stroke;
+                    if (Layer != null) Layer.UpdateShape(this);
+                }
 
+            }
+        }
+        public Brush Fill
+        {
+            get { return _fill; }
+            set
+            {
+                _fill = value;
+                if (IsLoaded)
+                {
+                    _ellipse.Fill = _fill;
+                    if (Layer != null) Layer.UpdateShape(this);
+                }
+            }
+        }
+

Jun 16, 2011 at 3:09 PM

Thanks

Jun 16, 2011 at 3:29 PM

Any idea on how to make this point an image instead of an ellipse?