XAML style
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="buttonCell"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Button Content="{TemplateBinding Content}" /> </ControlTemplate> </Setter.Value> </Setter> </Style>
C# code
UnboundField f = new UnboundField(); f.Name = "Unbound Field"; f.Settings.CellValuePresenterStyle = Application.Current.Resources["buttonCell"]
I wanted to access the control template of this unbound field from code. Can you help me with this?
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I suggest you use the following code in order to get the Element in the CellValuePresenter:
Button button = Utilities.GetDescendantFromType(CellValuePresenter.FromCell(xamDataGrid1.ActiveCell),typeof(Button),true) as Button;
Feel free to write me if you have further questions.