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
1339
PerformAutoSize Cannot Size Cell Using Template
posted

Using version 13.1.20131.1009 I'm setting the Template property of the CellValuePresenter for a given Field to show an image next to the text value of each cell:         

<Style TargetType="{x:Type igWPF:CellValuePresenter}" x:Key="SomeStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igWPF:CellValuePresenter}">
<StackPanel Orientation="Horizontal">
<Image Width="16"
Height="16"
Margin="6,0,6,0"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
<TextBlock Text="{Binding Path=DataItem.Item1}" VerticalAlignment="Center" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

When I call PerformAutoResize() on this field, it doesn't register any width for the data cells and only accounts for the label:

 

field.PerformAutoSize(FieldAutoSizeOptions.All, FieldAutoSizeScope.AllRecords);

 

Please see attached for a project demonstrating this issue.

PerformAutoResize.zip
  • 138253
    Verified Answer
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I modified the sample you have sent, so now it works as you want. Basically instead of setting the CellValuePresenter’s Template, I set its DataTemplate, because when you set the Template all the built-in functionality is lost. I can suggest you do so in the future or copy the default Style for the CellValuePresenter and modify it. You can find the default Templates here by default:

     

    C:\Program Files (x86)\Infragistics\NetAdvantage 2013.1\WPF\DefaultStyles

     

    Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

    PerformAutoResizeModified.zip