Whenever I run my code, after a specified action, I get an AgrumentException citing:
Must disconnect specified child from current parent Visual before attaching to new parent Visual.
After lot of digging, I narrowed down to the following conclusion...
private void ShowChecksum(string hash) {
Checksum.Text = hash;
}
Where Checksum is a text block and hash is a string that is being passed by a method parameter from another thread through the Dispatcher. If I comment the above line, my code runs fine.
Any Ideas? I've been after this for a while.
And If you require some mode code, I will gladly provide it.
EDIT: Here's the declaration (only a part not all.)
<StackPanel x:Name="Result" DockPanel.Dock="Top" Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed" Margin="40">
<StackPanel Orientation="Horizontal">
<Image x:Name="FileIcon" Source="Resources/file.png" Width="48"/>
<Label x:Name="FileName" VerticalAlignment="Bottom" FontSize="24"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding SelectedItem, ElementName=Algorithm}" FontSize="14" />
<TextBlock x:Name="Checksum" FontSize="14" />
</StackPanel>
<StackPanel>
<Button Content="Save to file" Style="{DynamicResource BlueButton}" Width="auto" Height="25" Margin="30"/>
</StackPanel>
</StackPanel>
Now this is kinda weird error in this situation, coz this exception is generally happens when we try to add an element to any other container.
Thanks in Advance,
Amitosh