In my UWP (Universal Windows Platform) app I need to create a Hyperlink
element with an image in it:
var hyperlink = new Hyperlink();
var container = new InlineUIContainer { Child = new Image() { ... } };
hyperlink.Inlines.Add(container);
This Hyperlink
gets later added to a TextBlock
together with other elements. My problem is, that the last line (Inlines.Add()
) throws an exception:
Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
Additional information: Value does not fall within the expected range.
Does someone know a way around this problem?