c# - 在 C# wpf 中的 slider 上添加直方图

标签 c# wpf rad-controls

如何使用 C# WPF 在 Radslider 上绘制直方图,如下图所示?我在网上搜索过,但没有得到信息。

enter image description here

最佳答案

你好,

               <StackPanel  Grid.Column="1"  Margin="7,-72,7.5,0">
                     <telerik:RadCartesianChart Palette="Summer" >
                          <telerik:RadCartesianChart.HorizontalAxis>
                             <telerik:CategoricalAxis Visibility="Hidden"/>
                        </telerik:RadCartesianChart.HorizontalAxis>
                        <telerik:RadCartesianChart.VerticalAxis>
                         <telerik:LinearAxis Visibility="Hidden" MajorStep="20" />
                    </telerik:RadCartesianChart.VerticalAxis>
                    <telerik:RadCartesianChart.Series>
                        <telerik:BarSeries ItemsSource="{Binding KeyValue, Mode=TwoWay}" CategoryBinding="Key" ValueBinding="Value">
                            <telerik:BarSeries.PointTemplates>
                                <DataTemplate>
                                    <Rectangle Width="3" Fill="SkyBlue"/>
                                </DataTemplate>
                            </telerik:BarSeries.PointTemplates>
                        </telerik:BarSeries>
                    </telerik:RadCartesianChart.Series>
                </telerik:RadCartesianChart>
            </StackPanel>

           <telerik:RadSlider Minimum="{Binding LowValue,Mode=TwoWay}"  Height="13" 
            Margin="5" Grid.Column="1" Maximum="{Binding HighValue,Mode=TwoWay}" 
            SelectionEnd="{Binding SelectionHigh,Mode=TwoWay}" 
            SelectionStart="  {Binding SelectionLow,Mode=TwoWay}"
            TickPlacement="TopLeft"  
            SelectionChanged="RadSlider_SelectionChanged" SelectionRangeEnabled="True" 
            IsDirectionReversed="False" SmallChange="10" VerticalAlignment="Bottom">                        
             </telerik:RadSlider>

除了自定义 RadSlider,您还可以在我显示的同一列中添加 RadChart & RadSlider。 我只是将 Xaml 代码与绑定(bind)放在一起,现在您可以编写直方图的逻辑了。

关于c# - 在 C# wpf 中的 slider 上添加直方图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25029650/

相关文章:

winforms - 如何隐藏 Winforms RadScrollablePanel 的 RadControls 中的边框

c# - 如何以编程方式将具有数据源的 RadComboBox 设置为 AutomaticLoadOnDemand

c# - Team Foundation Server 是将 .net 网站自动发布到远程服务器的正确解决方案吗?

c# - 我应该使用什么组件来显示启用/禁用状态?

c# - 为什么 ObservableCollection 隐藏 INotifyPropertyChanged.PropertyChanged

c# - WPF DataTemplate 绑定(bind)取决于属性的类型

c# - C#中的淡入淡出控制

c# - 如何读取屏幕分辨率 - 并更改此分辨率?

asp.net - 最佳中小型应用架构

c# - Radpanelbar 折叠/展开问题