How to create markers (or customItems) on demand

2 posts, 0 answers
  1. Chris
    Chris avatar
    23 posts
    Member since:
    May 2011

    Posted 11 Jun 2012 Link to this post

    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>
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Jun 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top