I have an unbound field, something like:
<igDP:UnboundField Name="MyUnboundField" DataType="{x:Type System:Double}">
<igDP:UnboundField.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource MyUnboundCellStyle}" EditorType="{x:Type igEditors:XamNumericEditor}" EditorStyle="{StaticResource MyUnboundEditorStyle}"/>
</igDP:UnboundField.Settings>
</igDP:UnboundField>
Now, I want to set the value of this unbound field based off of three other bound fields. I would also like for the unbound field to be sortable.
How should I go about doing this? Is there a way for me to just set the value of the cell via a style or do I have to do it differently?
I wrote a MultiValue converter and was thinking about using the below styles:
<Style x:Key="MyUnboundEditorStyle" TargetType="{x:Type Editors:XamNumericEditor}">
<Setter Property="Format" Value="0.00"></Setter>
</Style>
<Style x:Key="MyUnboundCellStyle" TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{StaticResource {x:Type igDP:CellValuePresenter}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0,0,0">
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentControl.Content>
<MultiBinding Converter="{StaticResource myConverter}">
<Binding Mode="OneWay" Path="DataItem.Item1"/>
<Binding Mode="OneWay" Path="DataItem.Item2"/>
<Binding Mode="OneWay" Path="DataItem.Item3"/>
</MultiBinding>
</ContentControl.Content>
</ContentControl>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
But if I do it this way, the editor style is not applied (since the template is no longer a XamNumericEditor) and the column does not sort (probably since it isn't bound to anything).
Is there a simple way (mostly using xaml) to have my unbound field set to the correct value and be sortable? I am sure I am missing something simple but I am new to the xamDataGrid (and to a lesser extent WPF). I don't have to create a new property and actually use a bound field do I?
Maybe someone can offer an example of binding an unbound column to the result of some conversion based on some bound columns (where sorting the unbound col works)?
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 through your post and I suggest you look into this forum thread:
http://news.infragistics.com/forums/p/6190/297074.aspx
where a similar issue like yours is discussed.
Feel free to write me if you have further questions.