This is a migrated thread and some comments may be shown as answers.

How to create markers (or customItems) on demand

1 Answer 61 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 11 Jun 2012, 07:07 PM
We are creating a linear gauge, it needs to show some extra markers (on-demand based on user's setting, binding to "Markers").
We tried to add <telerik:LinearScale.CustomItems>, but we can not set up the databinding... and we tried to add
CustomItems="{Binding Markers}"
CustomItemTemplate="{StaticResource CustomItemTemplate}"
but we cannot make it work.

BTW: as the code shows below, the gauge shows "CurrentFrameNumber" on the top of the gauge, and we would like the extra markers appear on the bottom of the gauge.

Could you please help?
Thanks.

<telerik:RadHorizontalLinearGauge Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="TimeGauge" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="0" OuterBackground="#00000000" OuterBorderThickness="0" Background="#00000000" BorderBrush="#00000000">
                <telerik:LinearScale x:Name="TimeScale"
                                     Min="{Binding Min}"
                                     Max="{Binding Max}"
                                     IsInteractive="True"
                                     RelativeX="0.04"
                                     RelativeWidth="0.92" RelativeY="0.6"
                                     FontSize="10"
                                     Fill="#4D0000F9"
                                     CustomItems="{Binding Markers}"
                                     CustomItemTemplate="{StaticResource CustomItemTemplate}">
                    <telerik:LinearScale.Indicators>
                        <telerik:BarIndicator x:Name="TrackBar"
                                              Value="{Binding CurrentFrameNumber, Mode=TwoWay}" IsAnimated="False" Background="#FF00C500" />
                        <telerik:Marker x:Name="CurrentFrameMarker"
                                        Value="{Binding CurrentFrameNumber, Mode=TwoWay}"
                                        telerik:ScaleObject.Offset="0.10"
                                        telerik:LinearScale.RotateForVertical="True"
                                        telerik:ScaleObject.RelativeWidth="0.04"
                                        telerik:ScaleObject.RelativeHeight="0.30"
                                        telerik:ScaleObject.Location="Outside">
                            <telerik:Marker.Template>
                                <ControlTemplate TargetType="{x:Type telerik:Marker}">
                                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                        <Polygon Points="0,0 0,0.7 0.5,1 1,0.7 1,0"
                                                 Stretch="Fill"
                                                 Fill="Yellow"
                                                 Stroke="Green"
                                                 StrokeThickness="2" />
                                    </Grid>
                                </ControlTemplate>
                            </telerik:Marker.Template>
                        </telerik:Marker>
                    </telerik:LinearScale.Indicators>
                </telerik:LinearScale>
            </telerik:RadHorizontalLinearGauge>

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 14 Jun 2012, 08:20 AM
Hi Chris,

It is very complicated and it is hard to reproduce the problem without your solution, but using just the code snippet you sent. Could you, please, provide us with your solution or with a small sample solution which reproduces it?

All the best,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Gauges
Asked by
Chris
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or