Telerik Forums
UI for WPF Forum
1 answer
151 views
My RadGridView instances always have several properties that are set exactly the same way. Something like this:

<telerik:RadGridView  RowIndicatorVisibility="Collapsed"  AllowDrop="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserReorderColumns="False" GridLinesVisibility="Both" ShowGroupPanel="False" ShowColumnHeaders="True" IsFilteringAllowed="False" CanUserFreezeColumns="False" CanUserInsertRows="False" >...</telerik:RadGridView>

So I thought, why not derive from this control and set those properties in the constructor?  I wrote this class that extends RadGridView:

namespace MyUI
{
 public class MyGridView : Telerik.Windows.Controls.RadGridView
    {
        public MyGridView()
            : base()
        {
            this.RowIndicatorVisibility = System.Windows.Visibility.Collapsed;
            this.AllowDrop = false;
            this.AutoGenerateColumns = false;
            this.CanUserDeleteRows = false;
            this.CanUserReorderColumns = false;
            this.GridLinesVisibility = Telerik.Windows.Controls.GridView.GridLinesVisibility.Both;
            this.ShowGroupPanel = false;
            this.ShowColumnHeaders = true;
            this.IsFilteringAllowed = false;
            this.CanUserFreezeColumns = false;
            this.CanUserInsertRows = false;
        }
    }
}

Okay, so using this should be as simple as this:

<Window ...
  xmlns:local="clr-namespace:MyUI;assembly=MyUI">
 
<local:MyGridView >...</local:MyGridView>
 
</Window>

It won't compile.  I get an error that says "The name 'MyGridView' does not exist in the namespace 'clr-namespace:MyUI'".

I've tried declaring the namespace with and without the "assembly=MyUI" part.  

What am I doing wrong here?

Thanks.

Aaron
Dimitrina
Telerik team
 answered on 01 Apr 2015
3 answers
127 views
Hello

I am using the RadDataPager in UnboundMode in connection with a RadGridView or a RadListBox.
The data from a page are loaded by an Event PageIndexChanged.
How can I navigate to a certain page (for example page 3) or select a certain element in Code-Behind or in XAML.
The commands PageIndex=3 or MoveToPage(3) seem to have no effect.

Sincerely,
A. Kasar
Dimitrina
Telerik team
 answered on 01 Apr 2015
1 answer
383 views
Hi,

May I know is there anyway to style the row validation of Telerik Rad Grid View where I only want a red border line to highlight the particular row that have error, but not the default style where the entire row is in red. 
Dimitrina
Telerik team
 answered on 01 Apr 2015
17 answers
207 views
It seems that the first character entered is only handled as the EditTrigger but the actual character isn't input in the grid.

When I have a cell selected but not in edit mode I want to write 4567in it. In excel this would work. In radgrid the original 4 keypress would enter edit mode, then 567 would be entered into the cell. How can I make it so that the 4 is both handled as a EditTrigger as well as input?
Dimitrina
Telerik team
 answered on 01 Apr 2015
5 answers
299 views
Hi,
I try to find real position of shape. Position object in the shape doesn't provide it. I think you have a kind of position mechanism. I have a shape object, and I get diagram object by using the shape object.
I tried

DiagramExtensions.GetTransformedPoint(diagram,shape.Position);

,but it return same value.

And I tried this

var parent = ParentFinder.GetAncestor<RadDiagram>(shape);
var transformedPoint = shape.TransformToAncestor(parent)
              .Transform(new Point(0, 0));

but it return different value.
Actually I try to show popup which is positioned to shape object. I can try to position to Content, but then drag or selection operation handled by shape object.
How can I find real position of RadDiagramShape in the screen? or How can I show a popup according to position of the shape object.

Thanks in advance.
Pavel R. Pavlov
Telerik team
 answered on 01 Apr 2015
1 answer
72 views
Hi,

Is it possible to use the Colorizer with the SqlGeospaitalDataReader?
If it is, would it be possible to provide a sample?
Pavel R. Pavlov
Telerik team
 answered on 01 Apr 2015
2 answers
151 views
I want the layouts of some of my RadControls to be persisted in background via a new Thread/Task. The corresponding method is invoked so I can access the control that should be persisted without any error. But I'm always getting an exception at the time I call PersistenceManager.Save(control). Here's my code:

// --- Part of CustomRadGradView.cs (inherits from RadGridView) ---
 
// Save this RadGridViews layout in background
Task.Run(() =>
    {
        using (var manager = new CustomPersistenceManager())
        {
            // this is current RadGridView
            manager.SaveLayout(this, file);
        }
    }
}


// --- Part of CustomPersistenceManager.cs (inherits from PersistenceManager) ---
 
// save layout of any Telerik control
public bool SaveLayout(Control control, string file = null)
{
    // Current thread has no access to control -> Invoke required
    if (control.Dispatcher.CheckAccess() == false)
    {
        bool result = false;
        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => result = DoSaveLayout(control, file)));
        return result;
    }
 
    // Current thread has access to control
    return DoSaveLayout(control, file);
}
 
// save layout to stream
private bool DoSaveLayout(Control control, string file = null)
{
    // this lines work without any errors so method is invoked correctly; thread has access to control!
    string name = control.Name; // returns name of control
    control.Name = "New name"; // just for testing
 
    // Next line always throws an InvalidOperationException
    using (var stream = Save(control)) // call save method of Teleriks PersistenceManager class
    {
        stream.Seek(0, SeekOrigin.Begin);
 
        using (var reader = new StreamReader(stream))
        {
            string text = reader.ReadToEnd();
            File.WriteAllText(path, text);
        }
    }
}


Can you please provide help why PersistenceManager.Save method is always throwing an exception here? How to use PersistenceManager to save a layout in background/new Task?
Johannes
Top achievements
Rank 1
 answered on 01 Apr 2015
2 answers
144 views
Hello,

I am trying to zoom and change the offset on the horizontal and vertical axis from code behind.
The code seems to work for the horizontal axis but not the vertical.

For example, I have a vertical axis displaying [0; 10]. I want to see [5,6], but the chart displays the [9,10] interval.
I have checked the virtualHeight (in this case 6850.0) and new value of the panoffset seems good => 3425.0

Why do I have this behaviour ? Is there a property that need to be set ?

01.public static void ZoomInChart(RadCartesianChart chart, double absmin, double absmax, double ordmin, double ordmax)
02.        {
03.            if (chart != null)
04.            {
05.                double absMaxValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.HorizontalAxis)).ActualRange.Maximum;
06.                double absMinValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.HorizontalAxis)).ActualRange.Minimum;
07.                double absMaxDelta = Math.Abs(absMaxValue - absMinValue);
08.                double absDelta = Math.Abs(absmax - absmin);
09. 
10.                double abscoef = absDelta == 0 || double.IsNaN(absDelta) ? 1 : absMaxDelta / absDelta;
11.                 
12.                double ordMaxValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.VerticalAxis)).ActualRange.Maximum;
13.                double ordMinValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.VerticalAxis)).ActualRange.Minimum;
14.                double ordMaxDelta = Math.Abs(ordMaxValue - ordMinValue);
15.                double ordDelta = Math.Abs(ordmax - ordmin);
16.                                 
17.                double ordcoef = ordDelta == 0 || double.IsNaN(ordDelta) ? 1 : ordMaxDelta / ordDelta;
18. 
19.                chart.Zoom = new Size(abscoef, ordcoef);
20. 
21.                double virtualWidth = chart.PlotAreaClip.Width * chart.Zoom.Width;
22.                 
23.                double virtualHeight = chart.PlotAreaClip.Height * chart.Zoom.Height;
24. 
25.                // Produit en croix pour trouver la valeur du nouvel origine
26.                double absVal = (virtualWidth * (absmin - absMinValue)) / absMaxDelta;
27. 
28.                double ordVal = (virtualHeight * (ordmin - ordMinValue)) / ordMaxDelta;
29.                 
30.                if (!double.IsNaN(absVal) && !double.IsNaN(ordVal))
31.                {
32.                    chart.PanOffset = new Point(-absVal, -ordVal);
33.                }
34.            }
35.        }
Yisselda
Top achievements
Rank 1
 answered on 01 Apr 2015
8 answers
176 views
Hi,

I would like to know if it's possible to have the header bar of the expander the same color of the header that we have with the popup calendendar of the RadDatePicker?!?

Thank's
Alain
Milena
Telerik team
 answered on 01 Apr 2015
4 answers
516 views
I have a simple chart in a c#/wpf/mvvm design.  Currently working on a trial version of the Chart View to see if it'll meet our development requirements, so I'm totally new to Telerik tools.  I'm missing something on how to implement a tooltip for the chart.  I've struggled for a day, and cannot get tooltips to work.  ):

I've defined a tooltip in a datatemplate as follows.  Ultimately, I'll bind the tooltip to an object in the ViewModel, but can't get this statice text to even work for now.
<UserControl.Resources>
  <DataTemplate x:Key="PolicyTooltipTemplate">
    <Grid>
      <StackPanel>
        <TextBlock FontSize="11" Text="Why am I not appearing in the grids tooltip?? ):" />
      </StackPanel>
    </Grid>
  </DataTemplate>
</UserControl.Resources>

In my ChartView Bareries definition I specify the TootipTemplte to use as follows:
<chartView:BarSeries CategoryBinding="Year" TooltipTemplate="{StaticResource PolicyTooltipTemplate}"
    CombineMode="Stack"
    ValueBinding="PrimaryCoverage"
    ItemsSource="{Binding ModelAuditCoverageChartAGL}">
        <chartView:BarSeries.DefaultVisualStyle>
        <Style TargetType="Border">
        <Setter Property="Background" Value="DodgerBlue"/>

The chart display fine, (attached pic), but when I hover over the chart columns, I cannot get any tooltips?  Have I implemented tooltips incorrectly for the ChartView?  Thanks for any help!

Below is my full xaml:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
xmlns:viewModels="clr-namespace:CmtModeler.WPF.Modules.AccountManagement.ViewModels"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Chart"
xmlns:chartView="clr-namespace:Telerik.Windows.Controls.ChartView;assembly=Telerik.Windows.Controls.Chart"
x:Class="CmtModeler.WPF.Modules.AccountManagement.Views.AmModelAuditView"
mc:Ignorable="d" VerticalAlignment="Top" HorizontalAlignment="Left"
d:DesignHeight="300" d:DesignWidth="300"
x:Name="ModelAdjustmentView"
d:DataContext="{d:DesignInstance {x:Type viewModels:AmModelAuditViewModel}}">
<UserControl.DataContext>
<viewModels:AmModelAuditViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<DataTemplate x:Key="PolicyTooltipTemplate">
<Grid>
<StackPanel>
<TextBlock FontSize="11" Text="Why am I not appearing in the grids tooltip?? ):" />
</StackPanel>
</Grid>
</DataTemplate>
</UserControl.Resources>
<xctk:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="Loading...">
<Grid x:Name="GridOuterShell" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--Top gird containing models . . .-->
<DockPanel x:Name="DocPanelAuditModels" Grid.Row="0" Grid.Column="0">
<Grid>
<DataGrid x:Name="ModelsCededBoston" ItemsSource="{Binding ModelAudits}" SelectedItem="{Binding SelectedModelAudit}" Style="{StaticResource AccountMaintenanceGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Batch_Id}" Header="Batch Id" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Model_Desc}" Header="Model Description" Width="400*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Coverage_Id}" Header="Coverage Id" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding User_Id}" Header="User Id" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Model_Run_Dt}" Header="Model Run Dt" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Engine_Version}" Header="Engine Version" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Application_Version}" Header="Application Version" Width="200" IsReadOnly="True"/>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="DodgerBlue"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
</DockPanel>
<!--Chart showingdetals of selectedmodel . . .-->
<DockPanel x:Name="DocPanelAuditModelsDetails" Grid.Row="1" Grid.Column="0">
<telerik:RadCartesianChart x:Name="AuditModelRadChartView" Grid.Row="4" Grid.Column="0" Height ="500" Zoom="0, 0">
<telerik:RadCartesianChart.HorizontalAxis>
<chartView:CategoricalAxis LabelFitMode="Rotate" x:Name="HorizontalAxis" HorizontalAlignment="Stretch"
MajorTickInterval="1"
Title="Year"
LineThickness="2"
LineStroke="Black"
ShowLabels="True"/>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<chartView:LinearAxis LabelFormat ="###,##0" />
</telerik:RadCartesianChart.VerticalAxis>
<chartView:BarSeries CategoryBinding="Year" TooltipTemplate="{StaticResource PolicyTooltipTemplate}"
CombineMode="Stack"
ValueBinding="PrimaryCoverage"
ItemsSource="{Binding ModelAuditCoverageChartAGL}">
<chartView:BarSeries.DefaultVisualStyle>
<Style TargetType="Border">
<Setter Property="Background" Value="DodgerBlue"/>
</Style>
</chartView:BarSeries.DefaultVisualStyle>
</chartView:BarSeries>
</telerik:RadCartesianChart>
</DockPanel>
</Grid>
</xctk:BusyIndicator>
</UserControl>
Martin Ivanov
Telerik team
 answered on 01 Apr 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?