I finally found a solution. Nestor's solution is something I've already tried, and it did not work for me (I think I was at fault, to be honest though). However, the below resolved my problem nicely...
I trapped the Initialized event for the DataGrid, where I *could* get access to the columns, and did my work there... and it's ALL out of the XAML code. Here is an example of my solution. There may be a better way, but this works.
private void dataGidML300_Initialized( object sender, EventArgs e )
{
try
{
DataGrid dg = sender as DataGrid;
foreach( DataGridTextColumn col in dg.Columns )
{
string strColName = col.Header.ToString( );
if( strColName == mStrings.GetStringWithThreadCulture( "txtStep" ) )
col.Visibility = this.GridStep;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtStartTime" ) )
col.Visibility = this.GridStartTime;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtDuration" ) )
col.Visibility = this.GridDuration;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtStepType" ) )
col.Visibility = this.GridStepType;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtFluidVol" ) )
col.Visibility = this.GridFluidVolume;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtFlowRate" ) )
col.Visibility = this.GridFlowRate;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtValvePos" ) )
col.Visibility = this.GridValvePosition;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtTipSize" ) )
col.Visibility = this.GridTipSize;
else if( strColName == mStrings.GetStringWithThreadCulture( "txtLiquidClass" ) )
col.Visibility = this.GridLiquidClass;
}
}
catch( Exception ex )
{
Errors.ErrorMessage( ex, new StackFrame( ), true );
mLog.Error( ex.Message, ex );
}
}