I have a button with some multibinding to which is attached a command :
<Button Content="remove" HorizontalAlignment="Right" VerticalAlignment="Top" Cursor="Hand" Focusable="False">
<Button.Command>
<Binding Path="DataContext.DeleteColumnCommand" ElementName="treeView" />
</Button.Command>
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource midConverter}">
<Binding Path="Text" ElementName="tableName"/>
<Binding Path="Name" />
</MultiBinding>
</Button.CommandParameter>
</Button>
I see that when I put a breakpoint in the converter, every value is set and it looks like it is working.
However, when actually called on the command, I receive as argument an array populated with nulls !
I imagine that WPF reuses and mutates the array I saw in my converter, which does not make nonsense as this is a reference type which I have not allocated and in the context of WPF max performance is much needed.
My question is : what best summarizes the guidance/guarantees around mutation like that in WPF ?
Is there a rule around this ?
PS : I see here that other people had the same problem and did not understand the origin apparently.
PPS : I did not make my question clear enough may be, but it follows naturally that one has to allocate a new structure, list, array, whatever, on the heap, as the one you get might be reused. The question is : from this ad-hoc example, what are the rules for WPF in such cases ?