Hi Steph,
I am going to borrow from another of our MVP's Khalil, who explained this very well:
"This event is raised when fields are requested in a feature source method that does not exist in the feature source. It allows you to supplement the data from any outside source you have. It is used primarily when you have data relating to a particular feature or set of features that is not within source of the data. For example, you may have a shape file of the world whose .dbf component describes the area and population of each country. Additionally, in an outside SQL Server table, you may also have data about the countries, and it is this data that you wish to use for determining how you want to color each country. To integrate this SQL data, you simply create a filed name that does not exist in the .dbf file. Whenever Map Suite is queried to return records that specifically require this field, the FeatureSource will raise this event and allow the developer to supply the data. In this way, you can query the SQL table and store the data in some sort of collection, and then when the event is raised, simply supply that Data. As this is an event, it will raise for each feature and field combination requested.
This means that the event can be raised quite often, and we suggest that you cache the data you wish to supply in memory. We recommend against sending out a new SQL query each time this event is raised. Image that you are supplementing two columns and your query returns 2,000 rows. This means that if you requested those fields, the event would be raised 4,000 times."
Source: gis.thinkgeo.com/Support/Dis...fault.aspx
The CustomColumnFetchEvent only gets fired if there is a request for a column data that cannot be found in the original datasource. So you need to have a request for a ColumnValue that does not exist in your SQLFeaturesLayer for the CustomColumnFetch event to be fired. This request could perhaps be a TextStyle where you define a ColumnName that does not exist in your SQLFeatureLayer. When the CustomColumnFetch event fires you would get the value (myValue) from OccupationsSol that is your associated with the e.ID (this could be your LayerA_ID) and set the e.ColumnValue to myValue.
//Object c#
public IEnumerable OccupationsSol
{
get { return _oslst; }
set
{
_oslst = value;
}
//Load map
private void mapl_Loaded(object sender, RoutedEventArgs e)
{
mapSiane.MapUnit = ConstantsMap.MAPUNITEDISTANCE;
mapSiane.MapTools.Logo.IsEnabled = false;
....
MsSql2008FeatureLayer test = (MsSql2008FeatureLayer)mapSiane.FindFeatureLayer(ConstantsMap.NOMMSSQLLAYEROCCUPSOLSQL);
test.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital1("MyColumnNotFoundInTheMsSql2008FeatureLayer");
test.CustomColumnFetch += new EventHandler(test_CustomColumnFetch);
}
private void test_CustomColumnFetch(object sender, CustomColumnFetchEventArgs e)
{
myValue = //Value from your OccupationsSol object based on the e.Id.
//Get data from your OccupationsSol using any code necessary,based on the e.Id and set that data to the e.ColumnValue
e.ColumnValue = myValue;
}