Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
Setting a CellValuePresenterStyle in CodeBehind
posted

Is it possible to set a CellValuePresenterStyle in CodeBehind?

I have a lookless control with a template and want to push that template into the the CellValuePresenterStyle property.  Something like this :

 

 

 

 

 

 

FieldLayout gridLayout = new FieldLayout

();

 

 

// Set up FieldLayout

dataGrid.FieldLayouts.Add(gridLayout);

 

 

Field field = new Field(ColumnName, Label

);

field.Column = 0;

 

 

Style fieldStyle = new Style(typeof(CellValuePresenter

));

fieldStyle.Setters.Add(

 

new Setter(CellValuePresenter

.TemplateProperty, fieldElement.Template));

 

But the .Template property of my lookless control has TargetType of the lookless control, and not CellValuePresenter.


Any hints on how to accomplish this?