Telerik Forums
UI for WPF Forum
1 answer
169 views
Hello In my wpf application my requirement is to plot a two line graph with different color of point markers..
 i achived colours for point marker foor single line graph. but if try that method for two line graph am not getting result. am getting single line only,, 

Am getting double line if i use dataseries . but i need to do that by item series,,,

My values are from single tabel, two different columns....

here is my code...


        public void chartmain()
        {
            


            try
            {
        
                var qry = (from s in SvarkWindow.BPList
                           where (s.User_id.Equals(1))
                           orderby s.Test_date ascending
                           select new { s.BP_Score, s.BP_Score_Dia, s.Test_date }).ToList();

                if (qry.Count == 0)
                {
                    SvarkMessageBox.MessageBox.ShowInformation("No Records Found...");
                    radChart.Visibility = System.Windows.Visibility.Hidden;
                   //listStackPanel.Visibility = System.Windows.Visibility.Hidden;

                }
                else
                {

                    radChart.Visibility = System.Windows.Visibility.Visible;

                    List<BPChartHelper> HelperData = new List<BPChartHelper>();
                    List<BPChartHelper> HelperData1 = new List<BPChartHelper>();

                

                    foreach (var item in qry)
                    {
                        SvarkMessageBox.MessageBox.ShowInformation(item.ToString());
                        //lineSeries1.Add(new DataPoint() { YValue = Convert.ToDouble(item.BP_Score), XValue = item.Test_date.ToOADate() });
                        //lineSeries2.Add(new DataPoint() { YValue = Convert.ToDouble(item.BP_Score_Dia), XValue = item.Test_date.ToOADate() });

                        //valueList.Add(new KeyValuePair<DateTime, decimal>(item.Test_date.Date, item.HB_score));
                        HelperData.Add(new BPChartHelper(item.Test_date, item.BP_Score));
                        HelperData1.Add(new BPChartHelper(item.Test_date, item.BP_Score_Dia));


                    }


                
                  


                    SeriesMapping mapping = new SeriesMapping();
                    mapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
                    mapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XCategory));
                 radChart.ItemsSource = HelperData;
                    radChart.SeriesMappings.Add(mapping);
                    radChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
                    radChart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;
                    radChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
                    radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";
                    LineSeriesDefinition line = new LineSeriesDefinition();
                    radChart.DefaultSeriesDefinition = line;
                    line.ShowPointMarks = true;
                    line.ShowItemLabels = true;
                    line.Appearance.Stroke = new SolidColorBrush(Colors.DarkGreen);
                    line.Appearance.PointMark.Stroke = new SolidColorBrush(Colors.Black);
                    radChart.DefaultSeriesDefinition.PointMarkItemStyle = this.Resources["MyPointMark_Style"] as Style;
                    radChart.DefaultSeriesDefinition.SeriesItemLabelStyle = this.Resources["MySeriesItemLabel_Style"] as Style;
                    //**********************

                    SeriesMapping mapping1 = new SeriesMapping();
                    mapping1.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
                    mapping1.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XCategory));
                    radChart.ItemsSource = HelperData1;
                    radChart.SeriesMappings.Add(mapping1);
                    radChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
                    radChart.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;
                    radChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
                    radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";
                    LineSeriesDefinition line1 = new LineSeriesDefinition();
                    radChart.DefaultSeriesDefinition = line1;
                    line1.ShowPointMarks = true;
                    line1.ShowItemLabels = true;
                    line1.Appearance.Stroke = new SolidColorBrush(Colors.DarkBlue);
                    line1.Appearance.PointMark.Stroke = new SolidColorBrush(Colors.Red);
                    radChart.DefaultSeriesDefinition.PointMarkItemStyle = this.Resources["MyPointMark_Style"] as Style;
                    radChart.DefaultSeriesDefinition.SeriesItemLabelStyle = this.Resources["MySeriesItemLabel_Style"] as Style;




                  

                    this.radChart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Visible;
                    //**************
                    radChart.DefaultView.ChartLegend.UseAutoGeneratedItems = false;

                    ChartLegendItem item1 = new ChartLegendItem();
                    item1.Label = "BP SYS";
                    item1.MarkerFill = new SolidColorBrush(Colors.DarkGreen);
                    radChart.DefaultView.ChartLegend.Items.Add(item1);
                    ChartLegendItem item2 = new ChartLegendItem();
                    item2.Label = "BP DIA";
                    item2.MarkerFill = new SolidColorBrush(Colors.SkyBlue);
                    radChart.DefaultView.ChartLegend.Items.Add(item2);
                    radChart.DefaultView.ChartLegend.Header = "BP Results";
                    this.radChart.DefaultView.ChartLegend.LegendItemMarkerShape = MarkerShape.StarFiveRay;

                    //**************

                   // this.BPGridView.ItemsSource = qry;

                    //  this.radChart.DefaultView.ChartArea.DataSeries.Add(lineSeries1);
                    // this.radChart.DefaultView.ChartArea.DataSeries.Add(lineSeries2);




                }
            }
        


And My Helper Class.....

class BPChartHelper : INotifyPropertyChanged
    {
        private DateTime _date;
        private SolidColorBrush _pointMarkFill;
        private decimal _yvalue;
        public BPChartHelper(DateTime date, decimal yvalue)
        {
            this._date = date;
            this._yvalue = yvalue;
            this.UpdatePointMarkVisibility();
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public DateTime Date
        {
            get
            {
                return _date;
            }
            set
            {
                if (this._date == value)
                    return;
                this._date = value;
                this.OnPropertyChanged("Date");
            }
        }
        public decimal YValue
        {
            get
            {
                return _yvalue;
            }
            set
            {
                if (this._yvalue == value)
                    return;
                this._yvalue = value;
                this.OnPropertyChanged("YValue");
            }
        }

        
        

        public SolidColorBrush PointMarkFill
        {
            get
            {
                return _pointMarkFill;
            }
            private set
            {
                if (object.Equals(this._pointMarkFill, value))
                    return;
                this._pointMarkFill = value;
                this.OnPropertyChanged("PointMarkVisibility");
            }
        }
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        private void UpdatePointMarkVisibility()
        {
            if (this.YValue <=100)
                this.PointMarkFill = new SolidColorBrush(Colors.DarkGreen);
            else if(this.YValue<=105 && this.YValue>=100)
                this.PointMarkFill = new SolidColorBrush(Colors.DarkBlue);
            else if(this.YValue>=105 &&this.YValue<=120)
                this.PointMarkFill = new SolidColorBrush(Colors.Pink);
            else if (this.YValue >= 120 && this.YValue <= 125)
                this.PointMarkFill = new SolidColorBrush(Colors.Orange);
            else if (this.YValue >= 125 && this.YValue <= 130)
                this.PointMarkFill = new SolidColorBrush(Colors.Red);
        }



    }
}



Petar Marchev
Telerik team
 answered on 11 Dec 2013
3 answers
85 views
Hello,

i use RadExpander with theme Expression_Dark. It looks like that, the style of header has been set to standard style. So the header text is black. It will not be seen easily. Have you resolved this problem? Or that is just so specified ;)

Thanks.

Ivan
Stefan
Telerik team
 answered on 11 Dec 2013
1 answer
138 views
Hi everyone,
I can export the whole map image file now using the code below.
using (Stream stream = dialog.OpenFile())
{
    FrameworkElement element = this.m_Radmap.FindChildByType<ItemsPresenter>();
    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(
        element, stream, new PngBitmapEncoder());
}

But the problem is that I have added a few marks on radmap information layer.
How to export these marks together with the map image?
Andrey
Telerik team
 answered on 11 Dec 2013
3 answers
111 views
I have a gauge that has a smaller Min and Max than the allowed values for my needle binding. For instance I have my Min set to 20 and my Max set to 80. The valid range is actually 0-100. 

The needle therefore goes outside of the gauge. Other than putting a valueconverter on the needle value to stop this behaviour is there any built in way I've missed to limit the needle?

Note: The bound property is used elsewhere, where the actual upper and lower limits are valid, so I can't limit it in the class. The only other way I could think of is to create a separate property that does the limiting in the class and then bind to that instead, which I guess would be better performing than a converter.

Thanks...
Andrey
Telerik team
 answered on 11 Dec 2013
1 answer
66 views
Hi,



I tried to use the InformationLayer.GetBestView(items), but it requires to be called several times to have correct result.

(If it is called with MapPinPoint)



Here is the template of the MapPinPoint :



<DataTemplate x:Key="ObstructionPointItemTemplate"><br>
            <telerik:MapPinPoint <br>
                BorderBrush="{StaticResource ObstructionPointColor}"<br>
                Template="{StaticResource PointControlTemplate}" <br>
                telerik:MapLayer.Location="{Binding }"><br>
                <telerik:MapLayer.HotSpot><br>
                    <telerik:HotSpot X="0.5" Y="0.5" /><br>
                </telerik:MapLayer.HotSpot><br>
            </telerik:MapPinPoint><br>
</DataTemplate>






In order to eliminate any side effects with the databinding or the map provider latency, the call to 'GetBestView' is made by an event handler attached to a user interaction (MouseRightButtonDown).



I have a lightweight VS2012 solution were I reproduced the issue, if needed





Can you please help me ?





Thanks in advance
Andrey
Telerik team
 answered on 10 Dec 2013
1 answer
426 views
Hello, I'm using the RichTextBox and cannot get the alignment to work. Here's my code:
radRichTextBox.Insert("Sample Text");
radRichTextBox.ChangeTextAlignment(Telerik.Windows.Documents.Layout.RadTextAlignment.Center);

I would like "Sample Text" to be center aligned but it doesn't work. When adding the control I select the "Text Box or Rich Text Box" option and all the defaults after that. If I select "Word Processor", the alignment code works. Does alignment only work when selecting "Word Processor"? Maybe there's a property I need to add to get the alignment to work when selecting "Text Box or Rich Text Box".

Thanks,
Scott
Svetoslav
Telerik team
 answered on 10 Dec 2013
3 answers
118 views

I have a WPF application that uses the RadGridView control to display search results:


<telerik:RadGridView AutoExpandGroups="True"
                                         AutoGenerateColumns="False"
                                         CanUserDeleteRows="False"
                                         CanUserFreezeColumns="False"
                                         CanUserInsertRows="False"
                                         CanUserResizeColumns="True"
                                         CanUserSortColumns="True"
                                         EnableColumnVirtualization="True"
                                         EnableRowVirtualization="True"
                                         FontSize="{x:Static res:Car.Common_DataEntryFontSize}"
                                         FontWeight="Bold"
                                         IsBusy="{Binding Path=IsLoadingReads, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                         IsReadOnly="True"
                                         MouseDoubleClick="ReadsGrid_MouseDoubleClick"
                                         Name="ReadsGrid"
                                         RowIndicatorVisibility="Collapsed"
                                         RowStyleSelector="{StaticResource StyleSelector}"
                                         SelectionChanged="ReadsGrid_SelectionChanged"
                                         SelectionUnit="FullRow"
                                         ScrollViewer.CanContentScroll="True"
                                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         ShowGroupFooters="True"
                                         ToolTip="{x:Static res:Car.Searcher_ReadsGrid_ToolTip}">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Plate,     Mode=OneWay}"
                                                        Header="{x:Static res:Car.Common_Plate}"
                                                        Width="*" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding State,     Mode=OneWay}"
                                                        Header="{x:Static res:Car.Common_State}"
                                                        Width="75" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding TimeStamp,  Mode=OneWay, Converter={StaticResource DateConverter}}"
                                                        Header="{x:Static res:Car.Common_DateNTime}"
                                                        Width="Auto" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Latitude, Mode=OneWay, Converter={StaticResource CoordConverter}, ConverterParameter={x:Static res:Car.GpsStatus_NS}}"
                                                        Header="{x:Static res:Car.Searcher_Latitude}"
                                                        Width="Auto" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Longitude, Mode=OneWay, Converter={StaticResource CoordConverter}, ConverterParameter={x:Static res:Car.GpsStatus_EW}}"
                                                        Header="{x:Static res:Car.Searcher_Longitude}"
                                                        Width="Auto" />
                            <telerik:GridViewImageColumn DataMemberBinding="{Binding GpsQuality, Mode=OneWay, Converter={StaticResource DeviceStatuses}}"
                                                         Header="{x:Static res:Car.Searcher_GpsQuality}"
                                                         ImageStretch="None"
                                                         Width="125" />
                        </telerik:RadGridView.Columns>
                        <telerik:RadGridView.CommandBindings>
                                    <CommandBinding CanExecute="DisplayEditRecordDetails_CanExecute" Command="cs:CarSystemCommands.DisplayEditRecordDetails" Executed="DisplayEditRecordDetails_Executed" />
                        </telerik:RadGridView.CommandBindings>
                    </telerik:RadGridView>


This works well when the machine culture is set to en-US.  However, when the machine culture is set to es-CL (Chile), the Group By Panel is still in English.  How do I get the Group By panel to display in Spanish?

Dimitrina
Telerik team
 answered on 10 Dec 2013
3 answers
126 views
Hi
I have a GridView hosted within a PropertyGrid.PropertyDefinition.EditorTemplate. If the grid is empty, when the Insert key is pressed a new row is not added to the grid. If the grid has data a new row is added to the grid.

When the grid is empty, before I press the Insert key, I click a column header in the grid (I can see the sort glyph change in the column header). If I click the filter button so that the filter dialog is displayed and then press Insert, a new row is added to the grid.

If I take it out of the PropertyGrid and display it independently, a new row does appear on Insert key press if the grid is empty or not.

Something doesn't seem right to me.

Regards,
Craig

RadControls for WPF Q3 2013 (2013.3.1016.40)


Dimitrina
Telerik team
 answered on 10 Dec 2013
3 answers
67 views

My name is LAZAU Florin and I am using gridview from telerik.

I want to edit the tamplate and I use blend. The problems is that after I click edit tamplate a got an error:"key cannot be null.Parameter name : key". I attach a sample image



Dimitrina
Telerik team
 answered on 10 Dec 2013
1 answer
281 views
Hi,

I'm currently using Wpf 2013 Q3 with nuget separate package.

I added merged dictionnary for all used packages.

All components work but not RadTreeView and RadDiagram.

RadTreeView and RadDiagram stay blank on the application

Regards 

Laurent

Tina Stancheva
Telerik team
 answered on 10 Dec 2013
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?