Hello,
I would like to customize the range slider, so that I can set a value in the TrackFillStyle.
See attached Screenshot. How can I do that?
I am using the TrackFillStyle:
<Style x:Key="MainCriteriaTrackFillStyle" TargetType="igPrim:TrackFill"> <Setter Property="Template" > <Setter.Value> <ControlTemplate> <Grid> <TextBlock x:Name="txtRowNumber" Text="1" FontWeight="ExtraBold" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> <Rectangle Height="{TemplateBinding Height}" Fill="#78F96232"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Hello Markus,
Thank you for contacting Infragistics. I recommend setting Panel.ZIndex or swap the order on the elements within the grid portion of the ControlTemplate if you don't see the numbers. eg.
<TextBlock Panel.ZIndex="1" x:Name="txtRowNumber" Text="2" FontWeight="ExtraBold" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> <Rectangle Panel.ZIndex="0" Height="{TemplateBinding Height}" Opacity=".5" Fill="LightBlue"/>
I attached a sample below of this illustrated correctly.
Let me know if you have any questions.
5277.WpfApplication1.zip
Thank for your example. I think my question was not clear.
I would like to change the value (TextBlock.Text) in that "TrackFillStyle" at runtime. E.g. with binding. How can I do that?
Thank you for following up.
This can be achieved by using an Ancestor type Binding on the XamNumericRangeSlider's Thumbs[I].Value property.
eg.
<Style x:Key="MainCriteriaTrackFillStyle" TargetType="igPrim:TrackFill"> <Setter Property="Template" > <Setter.Value> <ControlTemplate> <Grid> <TextBlock Panel.ZIndex="1" x:Name="txtRowNumber" Text="{Binding Path=Thumbs[0].Value,StringFormat=Value:{0:#.0}, RelativeSource={RelativeSource AncestorType={x:Type ig:XamNumericRangeSlider}}}" FontWeight="ExtraBold" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> <Rectangle Panel.ZIndex="0" Height="{TemplateBinding Height}" Fill="#78F96232"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
I attached a sample below for more details. Let me know if you have any questions. 2843.WpfApplication1.zip