Telerik Forums
UI for WPF Forum
3 answers
346 views
Let me start this with, I am using the Q2 2012 version and this is my first attempt at using this control...

I am trying to use the pie chart to render data from database based on the dates entered by the user.  The user can reset these dates at any time and in which case I need to update the pie chart based on the new dates.  I have done this by setting up events and when the user enters the date, then I will refresh my pie chart data.

Problem 1) So at first I figured the easiest way to do this would be clear the points and re-add them.  However, this would throw an error stating index out of range.  In debug this was looking for the PieSeries.cs file.  You can reproduce this by displaying some data and then on the click of a button call pieChart.Series[0].DataPoints.Clear().  I can provide a call stack if necessary.

Problem 2) I then went back and added all the required datapoints in xaml and gave them a name.  I then changed it to use those named points and reset the values.  Now when I update the values and the labels, the chart itself is not updating.  Is there some call to tell the chart to re-evaluate the values?

Problem 3) When the user selects a date range that does not contain any data to be displayed, I need to update the chart to reflect this.  I currently set the points value to 0, but it doesn't update to reflect 0 values.  What is the best way to accomplish this?

Problem 4) When the user is hovering over a slice in the pie, I want to either be able to "explode" that slice or at least update the tooltip to reflect some other internal data.  I noticed in posts from the past that the "explode" event was ready, but is it ready now?  If so then what is the event?  If this event is not there then could you at least tell me how in the TooltipOpening even I can get the datapoint that the mouse is currently hovering over?

Thanks in advance for your time and efforts.
Lee Keel
Ves
Telerik team
 answered on 06 Dec 2012
0 answers
99 views
Hi All,

I am having 15 columns in my RadGridview. In the UI it shows 10 columns to see other 5 column i have to scroll horizontally. When i reorder the column,horizantal scroll bar is not scrolling some thing like in the screenshot. Is there any way to enable the horizontal scrollbar to move when i reorder? Please advise me on this.

Check the screenshot below :



Sakthi
Top achievements
Rank 1
 asked on 06 Dec 2012
7 answers
233 views
Hi,

For many properties I often initialise the underlying field in the get accessor. ie
public User SelectedCreatedBy
        {
            get
            {
                if (_SelectedCreatedBy != null)
                    _SelectedCreatedBy = new User();
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }
But binding "SelectedItem" to this property crashes the program when I start typing. If I remove the initialisation part, it works. ie:
public User SelectedCreatedBy
        {
            get
            {
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }

Was this a design decision with RadAutoCompleteBox or a bug? I've never had this problem with any other telerik controls.
Peter
Top achievements
Rank 1
 answered on 06 Dec 2012
0 answers
243 views
I would like to have the gridview paging size dynamically adjusted when gridview height changed, so that the grid would not have any void, nor would user require to scroll up and down.

I handled the gridview's SizeChanged event and tried the following code:

private void ItemsList_SizeChanged(object sender, SizeChangedEventArgs e)
{
    if (e.HeightChanged && ItemsList.ActualHeight > 0)
    {
        var pageSize = (int)(ItemsList.ActualHeight / ItemsList.RowHeight);
        if (ItemsList.ShowColumnHeaders)
            pageSize--;
        if(pageSize > 0)
            ItemPager.PageSize = pageSize;
    }
}

It pretty much worked, except when the column header is visible, as it the taller than the row height, the above calculation is not exact anymore. It also doesn't handle when horizontal scrollbar is visible.

Is there a better way to calculate the number of rows that should be visible?
Wenrong
Top achievements
Rank 1
 asked on 05 Dec 2012
1 answer
208 views
Note in the attached file that the gradient is applied to each individual value that makes up the bar fragment.
I want to set the gradient fill so it is applied only once to the fragment of the bar where it belongs.  How do I do that?
Thanks
<Window.Resources>
          
        <DataTemplate x:Key="AETemplate">
            <Rectangle>
                <Rectangle.Fill>
                    <RadialGradientBrush>
                        <GradientStop Color="#FF6DA7B6"/>
                        <GradientStop Color="#FF077085" Offset="1"/>
                    </RadialGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
        </DataTemplate>
  
  
        <DataTemplate x:Key="STPTemplate">
            <Rectangle>
                <Rectangle.Fill>
                    <RadialGradientBrush>
                        <GradientStop Color="#FFE0DFDA"/>
                        <GradientStop Color="#FFC2BE57" Offset="1"/>
                    </RadialGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
        </DataTemplate>
  
  
        <Style TargetType="{x:Type telerik:BarSeries}" x:Key="AEStyle">
            <Setter Property="Background">
                <Setter.Value>
                    <RadialGradientBrush>
                        <GradientStop Color="#FF6DA7B6"/>
                        <GradientStop Color="#FF077085" Offset="1"/>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
  
  
        <Style TargetType="Border" x:Key="STPStyle">
            <Setter Property="Background">
                <Setter.Value>
                    <RadialGradientBrush>
                        <GradientStop Color="#FFE0DFDA"/>
                        <GradientStop Color="#FFC2BE57" Offset="1"/>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
          
        <chart:RadCartesianChart x:Name="theChart">
            <chart:RadCartesianChart.HorizontalAxis>
                <chartView:CategoricalAxis FontFamily="Segoe UI" FontSize="12"  />
            </chart:RadCartesianChart.HorizontalAxis>
            <chart:RadCartesianChart.VerticalAxis>
                <chartView:LinearAxis FontFamily="Segoe UI" FontSize="12"
                                    Title="The Chart" 
                                    Minimum="0" Maximum="150"   />
            </chart:RadCartesianChart.VerticalAxis>
            <chart:RadCartesianChart.Grid>
                <chartView:CartesianChartGrid MajorLinesVisibility="XY" />
            </chart:RadCartesianChart.Grid>
        </chart:RadCartesianChart>
          
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <TextBox x:Name="tb" Height="30" Width="100"></TextBox>
            <Button Content="Click" Click="Button_Click" Height="30" Width="150" ></Button>
        </StackPanel>
    </Grid>
</Window>

private void AddSeries(string tag)
        {
            if(GroupedDataGroups == null)
                GroupedDataGroups = GroupedData.Groups.Cast<GroupingImpl<string, LoadStatistic>>();
  
            Style style;
            DataTemplate template;
  
            if (theChart.Series.Count == 0)
            {
                style = FindResource("AEStyle") as Style;
                template = FindResource("AETemplate") as DataTemplate;
            }
            else if (theChart.Series.Count == 1)
            {
                style = FindResource("STPStyle") as Style;
                template = FindResource("STPTemplate") as DataTemplate;
            }
            else
            {
                style = null;
                template = null;
            }
              
            var itemsSource = GroupedDataGroups.Where(x => x.Key.ToString() == tag).First().Items;
  
            var series = new Telerik.Windows.Controls.ChartView.BarSeries 
            
                Tag = tag,
                CombineMode = ChartSeriesCombineMode.Stack,
                CategoryBinding = new PropertyNameDataPointBinding("PeriodEnding"),
                ValueBinding = new PropertyNameDataPointBinding("TradeCount"),
                ItemsSource =  itemsSource,
                  
                //,  DefaultVisualStyle = style
            };
            series.PointTemplates.Add(template);
            theChart.Series.Add(series);
        }

Sam
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
236 views
I have a grid with the setting EditTriggers="TextInput,CellClick".  Text input seems to be triggered  by text with modifier keys, e.g. Ctrl-T, Alt-T.  I want to disable this behavior so that only text without a modifier puts the cell into edit mode.

I've tried using a custom keyboard command provider, but it appears that the default ProvideCommandsForKey() doesn't return commands for text input, and that there must be some other mechanism that triggers the edit mode.

How can I prevent text input with modifier keys from triggering edit mode.

Thanks,
-Jeff


Jeff
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
152 views
Hi everyone,

I have a problem: I use a RadRichTextBox and in code(in runtime) by button click event I insert a Table
with InlineUIContainers in each cell - everything is OK, but when I drag it using a Table aborner by mouse(a small cross in the left top of table) then all InlineUIContainers are removed!!! If cell contains just a Paragraph and span inside it - everithyng is OK, but
I need to use an InlineUIContainers with a Border and TextBlock element as implemented below in method

InitDataCell(...)

 

private void InsertDynamicTable(DynamicTableViewModel dynamicTableViewModel)
{
            var table = new Table();
            TableRow r1 = new TableRow();
            r1.Cells.Add(new TableCell());
            r1.Cells.Add(new TableCell());
            r1.Cells.Add(new TableCell());
            table.Rows.Add(r1);
 
            TableRow r2 = new TableRow();
            r2.Cells.Add(new TableCell());
            r2.Cells.Add(new TableCell());
            r2.Cells.Add(new TableCell());
            table.Rows.Add(r2);
 
            TableRow r3 = new TableRow();
            r3.Cells.Add(new TableCell());
            r3.Cells.Add(new TableCell());
            r3.Cells.Add(new TableCell());
            table.Rows.Add(r3);
 
            table.Tag = dynamicTableViewModel.ID.ToString();
            table.Borders = new TableBorders(new Border(dynamicTableViewModel.BorderThikness, BorderStyle.Single, dynamicTableViewModel.BorderColor));
 
            table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, dynamicTableViewModel.Width);
            table.LayoutMode = TableLayoutMode.Fixed;
 
            TableRow dataRow = table.Rows.ToArray().ToList()[1];
            List<TableCell> dataCells = dataRow.Cells.ToArray().ToList();
 
            List<double> dataCellHeights = new List<double>();
 
            for (int i = 0; i < dynamicTableViewModel.DynamicColumns.Count; i++)
            {
                TableCell dataCell = dataCells[i];
 
                InitHeaderCell(headerCell, dynamicTableViewModel.DynamicColumns[i]);
                      
                     //Initialize existant TableCell
                double dataCellHeight = InitDataCell(dataCell, dynamicTableViewModel.DynamicColumns[i]);

                dataCellHeights.Add(dataCellHeight);
            }
 
            UpdateRowHeight(dataRow, dataCellHeights);
            this.richEditor.InsertTable(table); 
             
            this.richEditor.UpdateEditorLayout();
            this.richEditor.Document.UpdateAllFields();
            this.richEditor.Document.UpdateLayout();                 
}
 
private double InitDataCell(TableCell dataCell, DynamicColumnViewModel columnVm)
{
            double cellHeight = 0;
 
            dataCell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, columnVm.Width);
            dataCell.TextAlignment = RadTextAlignment.Left;
            dataCell.VerticalAlignment = RadVerticalAlignment.Center;
            var paragraph = new Paragraph();
            paragraph.TextAlignment = RadTextAlignment.Right;
            dataCell.Blocks.Add(paragraph);
 
            dataCell.Background = columnVm.DynamicCellData.Background;
 
            Grid grid = new Grid();
 
            var tb = new TextBlock
            {
                Text = columnVm.DbColumnName,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                Tag = columnVm.DbColumnName,
                FontSize = columnVm.DynamicCellData.FontSize,
                Background = new SolidColorBrush(columnVm.DynamicCellData.Background),
                Foreground = new SolidColorBrush(columnVm.DynamicCellData.Foreground),
                FontFamily = columnVm.DynamicCellData.FontFamily,
                FontWeight = columnVm.DynamicCellData.FontWeight,
                FontStyle = columnVm.DynamicCellData.FontStyle,
                TextDecorations = columnVm.DynamicCellData.TextDecoration
            };
 
            tb.VerticalAlignment = VerticalAlignment.Bottom;
            tb.HorizontalAlignment = HorizontalAlignment.Right;
 
            System.Windows.Controls.Border border = new System.Windows.Controls.Border();
            border.BorderThickness = new Thickness(0);
            border.BorderBrush = Brushes.Transparent;
            border.Background = new SolidColorBrush(columnVm.DynamicCellData.Background);
            border.VerticalAlignment = VerticalAlignment.Center;
            border.HorizontalAlignment = HorizontalAlignment.Center;
            border.Child = tb;                                 
 
            border.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
 
            Size s = new Size(border.DesiredSize.Width + 1, tb.DesiredSize.Height - 1);
            var uic = new InlineUIContainer(border, s);           
 
            paragraph.Inlines.Add(uic);
 
            cellHeight = uic.Height + 5;
 
            return cellHeight;
}

Alexander
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
342 views
Hi,

I have a RadContextMenu inside a RadGridView and it works fine. So each row in RadGridView has is own RadContextMenu.
Now I would like to add some shortcut keys in order to get a context menu open in some submenu or to "click" automatically a submenu.

What do you suggest?

Thanks,

Rosen Vladimirov
Telerik team
 answered on 05 Dec 2012
5 answers
281 views
Hello there, I am assigning my axis in the following manner:
((Telerik.Windows.Controls.ChartView.ScatterPointSeries)xRadChartView_Cartesian.Series[0]).XValueBinding =
new Telerik.Windows.Controls.ChartView.GenericDataPointBinding<System.Data.DataRow, Int32?>()
{
ValueSelector = row => (Int32?)row["ColumnHeader"]
};

This is so that a chart can be created with an axis that could contain null values.  However, when those null values are present, I instead receive an exception at the code above, but only at the point when I am setting the chart data source.  The exception is an InvalidCastException and says that the 'Specified cast is not valid.'.  This only happens if the null values are present.  If they are normal ints then it all works as expected.

Is there an extra step I need to take to allow the chart to deal with these null values?  Either by displaying them as zeroes or just missing them out entirely, leaving just gaps?  The latter would be much more preferable.

Thanks in advance.
Nick
Telerik team
 answered on 05 Dec 2012
3 answers
356 views
I'm using the RadGridView to display a status list to the user, containing all the alarms of the system.
This list is usually filtered on all active alarms, meaning that once an alarm is acknowledged by the user or the system, it should disappear from the filtered list. (but not from the collection, only the filtered list).

However, when the acknowledged property (complete with OnPropertyChanged) is changed, the grid now displays the changed value, but the filter does not filter the item away. How can I achieve this?

I made a sample project describing the problem, but I can't upload it.
Rossen Hristov
Telerik team
 answered on 05 Dec 2012
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
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?