Select to view content in your preferred language

FeatureDataset

885
6
08-05-2010 01:52 PM
MarcoRosa
Emerging Contributor
Hi to all, it's possible to do the same setting on code behind ? Specially Path settings, because i would like to change this value dinamically

  <esri:FeatureDataGrid x:Name="MyDataGrid"
        Map="{Binding ElementName=MyMap}"
        GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[California]}" />

Thank's in advanced
GP
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
You can give the path in the Binding constructor or you can initialize the path after the creation.

Binding b = new Binding("Layers[California]");

or
 
Binding b = new Binding();
b.Path = "Layers[California]";
0 Kudos
MarcoRosa
Emerging Contributor
Hi Dominique, thanks for answer : i have done this

1)           System.Windows.Data.Binding b = new System.Windows.Data.Binding();
              b.Path = "Layers[2]";

have error message: "Cannot implicitly convert type 'string' to 'System.Windows.PropertyPath"

so i tried 2nd solution like this ...


2)

                System.Windows.Data.Binding bind = new System.Windows.Data.Binding();
                System.Windows.PropertyPath pt = new System.Windows.PropertyPath("Layers[2]");
                bind.ElementName = "Map";
                bind.Path = pt;
              
                MyDataGrid.DataContext = bind;

no errors but doesn't work ..


2)             System.Windows.Data.Binding b = new System.Windows.Data.Binding("Layers[2]");
                MyDataGrid.DataContext = b;

no errors but doesn't work ( tried also  MyDataGrid.DataContext = b.path)


Maybe the problem is how link binding to featuredatagrid ?
No reference with Graphicslayer ?

Thank's
GP
0 Kudos
DominiqueBroux
Esri Frequent Contributor

b.Path = "Layers[2]";

have error message: "Cannot implicitly convert type 'string' to 'System.Windows.PropertyPath"


My bad. You are right you need a PropertyPath
b.Path = new Propertypath("Layers[2]");

Sorry.

Note that the constructor form is OK with a string : Binding b = new Binding("Layers[2]");


MyDataGrid.DataContext = bind;

no errors but doesn't work ..


Programmatic binding is done by the 'SetBinding' method.
MyDataGrid.SetBinding(ESRI.ArcGIS.Client.Toolkit.FeatureDataGrid.GraphicsLayerProperty, b);
0 Kudos
MarcoRosa
Emerging Contributor
ok ... now i've to define GraphicsLayerProperty ....
i try ....

thank dominique see u soon
GP
0 Kudos
DominiqueBroux
Esri Frequent Contributor
GraphicsLayerProperty identifies a dependency property defined on the FeaturedataGrid.
The full path is :
ESRI.ArcGIS.Client.Toolkit.
FeatureDataGrid.GraphicsLayerProperty
0 Kudos
MarcoRosa
Emerging Contributor
Thks dominique ... all works fine ,,,,

thank u very much , have a good week end
0 Kudos