Telerik Forums
UI for WPF Forum
5 answers
310 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
80 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
162 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
152 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
182 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
548 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
1 answer
969 views
Hi guys

I have toyed all morning with this problem. I have a DataBound RadTreeView (with ItemsSource) that displays a Hierarchical data structure.

Because each item is displayed using the hierarchy I have no way of hooking into the "DoubleClick" event on a per-item basis.

After some time, I ended up binding SelectedItem to my ViewModel and hooking into the ItemDoubleClick event like below. Unfortunately this makes the assumption that SelectedItem is fired before ItemDoubleClick. So if possible I would love to know a way to hook into the DoubleClick event, so that I can bind the CommandParameter to the item that was double clicked.

<telerik:RadTreeView x:Name="ServerExplorerTreeView" Grid.Row="1" Margin="0 -2 0 0"
VerticalAlignment="Stretch" Background="{StaticResource LightGrayBackgroundBrush}"
IsLineEnabled="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" IsVirtualizing="True"
SelectionMode="Multiple" IsEditable="True" IsDragDropEnabled="True" ItemsSource="{Binding NavigatorVM.Root.ItemsView.View}"
SelectedItem="{Binding NavigatorVM.SelectedItem,Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ItemDoubleClick">
<i:InvokeCommandAction Command="{Binding NavigatorVM.ItemDoubleClickedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadTreeView>







Martin Ivanov
Telerik team
 answered on 01 Apr 2015
5 answers
300 views
Hi team,
I am blocked by how to implement such a scenario.
<DataTemplate DataType="model:Line">
    <telerik:RadExpander x:Name="lineExpander"
                         VerticalAlignment="Center"
                         Style="{StaticResource LineRadExpanderStyle}"
                         IsExpanded="True"
                         DataContext="{Binding}"
                         telerik:AnimationManager.IsAnimationEnabled="False">
        <telerik:RadExpander.Header>
            <TextBlock Text="{Binding Name}" FontSize="14"/>
        </telerik:RadExpander.Header>
        <telerik:RadExpander.Content>
            <telerik:RadDiagram x:Name="xDiagram"/>
        </telerik:RadExpander.Content>
    </telerik:RadExpander>
</DataTemplate>

We know that we need to generate a ObservableGraphSourceBase object and assign it to GraphSource property. In my case, i need to turn the bound Line instance into Nodes and Links in the graph source and also whatever changes the Line object has, it should be refreshed in the diagram.

Thanks,
Jingfei
Petar Mladenov
Telerik team
 answered on 01 Apr 2015
1 answer
122 views
I have a rowdetails template with a set height, in a grid row with a set height set to display in a detailspresenter with a set height. They are all set to 300 pixels but there is still not vertical scroll bar showing up. 

Any ideas?

Thanks!
Eric
Stefan
Telerik team
 answered on 01 Apr 2015
2 answers
485 views
Hello, I have a RadTabControl with several RadTadItems, I've created a style for each RadTabItem to assign different colors to the headers:

<Style TargetType="telerik:RadTabItem" x:Key="TabItemStyle1">
            <Setter Property="Background" Value="Red"/>
</Style>

Is it possible to assign the same color of the header when the RadTabItem is selected?

Thanks in advance,

Alberto
Amige
Top achievements
Rank 1
Veteran
 answered on 31 Mar 2015
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?