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.
I have been looking into your post and you cannot set a ContentTemplate for the ValueOverlay because it is just a horizontal/vertical line. It is the same like trying to set a ContentTemplate to a Path.
Let me know, if you have any other questions on this matter.
Well then, how can i template a value overlay?
I am just checking if you require any further assistance on the matter.
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.
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?