Select to view content in your preferred language

Please help me , I have a big problem

508
4
03-31-2012 01:12 PM
mohammadabdullah
New Contributor
Hello every body !!! .
     Now , i develop silverlight application , which this  application contains two Usercontrols
   the first one
   add some information about certain shop and locate its location in the map to  store its location extents and its MapPoints from the map to Database
  the second one
  to retreive shop information and its location extents and mappoint from DB to locate these extents and MapPoint in the Map

but i have a big problem ???!!!! 😞

I'am working with MVVM in Silverlight
Now i have a problem in the binding to Extents XMAx , YMax , Xmin , Ymin to get stored extents from DB to set these extents to  Map extents

<esriGeometry:Envelope XMin="{Binding ExtentXMin}" YMin="{Binding ExtentYMin}" XMax="{Binding ExtentXMax}" YMax="{Binding ExtentYMax}" />

its not working this operation


please help me to solve this problem
thank you
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Unfortunately, Envelope is not a DependencyObject or it does not implement INotifyPropertyChanged, which makes these properties not support binding. You can however wrap it around another class that implements INotifyPropertyChanged.

Maybe something like this:
    public class MyEnvelope : INotifyPropertyChanged
    {
        private Envelope envelope;
        private Envelope Envelope
        {
            get
            {
                if (envelope == null)
                    envelope = new Envelope();
                return envelope;
            }
        }

        public double XMin
        {
            get { return Envelope.XMin; }
            set
            {
                if (Envelope.XMin != value)
                {
                    Envelope.XMin = value;
                    OnPropertyChanged("XMin");
                }
            }
        }

//more code

        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
    }
0 Kudos
mohammadabdullah
New Contributor
thank you very much

   but i have a question ,, this is about C# Side ,,, what about Xaml side ????
   what will i do in xaml to bind between this code and xaml
0 Kudos
RichardWatson
Deactivated User
0 Kudos
JenniferNery
Esri Regular Contributor
In XAML, you can then use your Envelope class that wrapped the API Envelope class instead.

<local:MyEnvelope XMin="{Binding xmin}" .../>
0 Kudos