Hi Infragistics Team,
I have a XamDataChart with a valueoverlay.
I'm using a style to set the control template.
That causes a nullptr exception in the xaml-editor and in the runtime thrown in some ig-method.
Please check this.
kmb
Hello Karl,
I have been looking into your sample application and I was wondering why you would like to re-template the ValueOverlay. It seems that you just want to change its background. If it is true, you need to set its ‘Brush’ property.
Let me know, if you need any further assistance on this matter.
Hello Yanko,
no i don't want to set the brush only. That was only an example to Show the control throwing an error when control template is used.
In my real application i have a control that allows dragging the line with the mouse. I allready use it for the Markers. It is derived from Content control. I want to refacture it using it also for the ValueOverlays.
for the markers it looks something like this:
<ig:LineSeries.MarkerTemplate>
<DataTemplate>
<Control>
<Control.Style>
<Style TargetType="Control">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Grid DataContext="{Binding Item}" >
<my:CStützpunktDragIncrementor Active="{Binding Model.UserLockProperty.Value,Converter={StaticResource Not}}" >
<Elipse>
<!-- Rest goes here -->
</Elipse>
</my:CStützpunktDragIncrementor >
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Control.Style>
</Control>
</DataTemplate>
</ig:LineSeries.MarkerTemplate>
I know I may also use an attached property but as the control has state Information it'll be quite sophisticated to manage this states in attached properties. Using a Content control seemed much more easy for this. I may refacture the control to use attached properties but this costs time again and so it would be better i could use the control as it is just adding some code to Switch between vertical and horicontal dragging. (The marker dragging works vertically as my value overlay dragging must work horicontally)
But therefor i Need the control template working for value overlays as shown in the example. Can you verify it's an Problem of the value overlay control? Will you fix it? Until?
regards.
Hi,
i've written a Content control that can be placed inside the canvas. It autmatically updates it's canvas Position so it is possible to place any control in the value overlay-line. I'll paste the source later as solution.
Before i have one more question: How can i determine the actual Color of the value overlay? (The Color is automatically assigned, i found this Color is not available via ValueOverlay.Foreground or ValueOverlay.Background.)
Which property reflects this Color?
Thanx in advance.
Hello,
Thank you for your feedback. If you want to change the color of the value overlay, you need to set its ‘Brush’ property.
sorry, i don't want to Change the Color.
I want to determine the Color which was automatically assigned. It seems it is another property because brush always contains null.
(I want to bind my templated Line to the original Color which is used by ValueOverlay)
Is this possible?
<ig:ValueOverlay.Style>
<Style TargetType="{x:Type ig:ValueOverlay}">
<ControlTemplate>
<Canvas x:Name="RootCanvas">
<my:CValueOverlayContentControl Cursor="Help" Width="100" >
<!-- ValueOverlay.Brush contains null. How to bind to the Color? -->
<Border Background="{Binding Brush,RelativeSource={RelativeSource AncestorType=ig:ValueOverlay, AncestorLevel=1}}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</my:CValueOverlayContentControl>
</Canvas>
</ig:ValueOverlay.Style>
I am just checking if you require any further assistance on the matter.
Yes there popped up another issue.
So i'm using a canvas to draw my own value overlay line which can be moved with the mouse. But the original line is still drawn.
As i want to Show a Special mouse Cursor and also Need to react on the mouse Events when the mouse is over the valueoverlay line
the only way i found is Setting the thickness of the value overlay to 0.
(Otherwise the mouse Cursor won't be shown on the original line and also dragging is not possible)
But when i set thickness to 0 the history does no more Display the line.
But i would like to have a line in the history item.
I was investigating a bit in the history issue and it seems it's not so easy to define a template for the history item.
Do you have an idea how i can Display the line in the history?
Thank you for your feedback. I have been looking into your question and the best approach in this scenario seems to be to make the default value overlay line invisible by access its visual element. This can be done handling the ‘Loaded’ event of Value Overlay and using our ‘Utilities’ class like e.g. :
private void valueOverlay_Loaded(object sender, RoutedEventArgs e)
{
Canvas canvas = Utilities.GetDescendantFromName(this.valueOverlay, "RootCanvas") as Canvas;
canvas.Children[2].Visibility = System.Windows.Visibility.Collapsed; // the default line
}
Ok, i Need to go a step back.
You wrote;
I was wondering why you want to bind the ‘Background’ of the Border your custom template to the original brush of the value overlay.
My Answer:
Ok, i wanted to bind the Background so that the line i draw has the same Color as the original line.
But that didn't work because ValueOVerlay.Background only defines a "override" value which is null by Default.
You said i shall then define the Color list by myself and use the first Color for drawing the Background that was ok.
It would be more flexible if i had a property that contained the generated Color for the series but that works out fine.
This is solved. I can now draw a value overlay by my self. :-)
Now the next:
You wrote:
If you set the value overlay’s brush to “Transparent” and set another brush for the border in your custom control, it
seems that the original line of the value overlay will not be shown.
That is correct. The original line will not be drawn because it is transparent i.e. has a thickness of 0.
But then the history item will be empty, as it draws the line also transparent / thickness 0.
Then my question is:
How can i draw a line in the history item when the value overlay is transparent and/or has a 0 thickness.
I have been looking into your issue and it seems that you have in mind the custom control that you are using in the template of the value overlay by history item. I was wondering why you want to bind the ‘Background’ of the Border your custom template to the original brush of the value overlay. If you set the value overlay’s brush to “Transparent” and set another brush for the border in your custom control, it seems that the original line of the value overlay will not be shown.