My RadCartesianChart uses an AnnotationsProvider showing CartesianPlotBandAnnotations. I set the LabelDefinitions with a DefaultVisualStyle that had the text as I wanted it. And it honors every property I set except the text color. That gets ignored, no matter what I set it to.
I've attached an image that shows what it looks like. You can see the region labels (literally named "Top" and "Bottom"). They show up in Italics as I want and using the FontSize I want. But the color remains grey when I'm trying to set it to white.
Here's my label definition resource
<tk:ChartAnnotationLabelDefinition x:Key="BandLabelDefinition" Location="Inside" VerticalAlignment="Bottom"> <tk:ChartAnnotationLabelDefinition.DefaultVisualStyle> <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockStyle}"> <Setter Property="FontSize" Value="{Binding Source={core:Settings}, Path=FontSizeSmall}"/> <Setter Property="FontStyle" Value="Italic"/> <Setter Property="Foreground" Value="White"/> </Style> </tk:ChartAnnotationLabelDefinition.DefaultVisualStyle></tk:ChartAnnotationLabelDefinition>
And here's the bit where I set it in the style of the CartesianPlotBandAnnotation
<Style x:Key="RegionBandStyle" TargetType="{x:Type tk:CartesianPlotBandAnnotation}"> <d:Style.DataContext> <x:Type Type="core:IProfileRegion" /> </d:Style.DataContext> <Setter Property="Label" Value="{Binding Name}"/> <Setter Property="LabelDefinition" Value="{StaticResource BandLabelDefinition}"/>What am I missing here? How may I set the font color in a label definition?
(Note: I also tried the approach of using the ChartAnnotationLabelDefinition.Template property instead of "DefaultVisualStyle". That didn't help at all)

I've noticed that if I have a child of a RadWindow that is currently in a validation error state, I cannot utilize the RadWindow's minimize, maximize or close buttons.
For example, a RadGridView with items that implement INotifyDataErrorInfo, when a new item is added, the new item's fields are invalid, but I cannot click the RadWindow's buttons unless I cancel out of the new row.
In addition, when adding debugging output to the events for the RadGridView's events, I've found that if I am in the middle of an edit in a cell, clicking any of the RadWindow's buttons causes it to fire the events for the cell and row edits ending prior to firing any of the RadWindow's events, such as clicking the close button fires the PreviewClosing event after the RadGridView's events.
Is there a way to give precedence to the RadWindow's buttons so they can be utilized regardless of the state of controls within the window and to run their events prior to controls in the RadWindow?

Hi,
I am trying specify RadDiagram Canvas size and I have two questions below.
Question 1)
When I set Width and Height of RadDiagram to large numbers,
ViewportRect.location of RadDiagramThumbnail is different.
Is this correct behavior and why is this happening?
Question 2)
With With and Height set, I am able to restrict the movement(or scroll?) of canvas to (0,0) and (width,height).
Below is the code I wrote to restrict the pan movement.
Now, I want to the same thing when I click and move mouse on RadDiagramThumbnail's ViewportRect.
How can I do this?
Thanks in advance.
Jaeho
MainWindow.xaml
<Grid x:Name="LyoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<telerik:RadDiagram x:Name="xDiagram"
Width="5760"
Height="3240"
MouseMove="diagram_MouseMove"
PreviewMouseDown="diagram_MouseDown"
PreviewMouseUp="diagram_MouseUp"
PreviewPan="Diagram_OnPreviewPan"
>
<telerik:RadDiagramShape x:Name="Shape1"
Content="Shape1"
Geometry="{telerik:FlowChartShape ShapeType=Database1Shape}"
Position="100,80" />
<telerik:RadDiagramShape x:Name="Shape2"
Content="Shape2"
Position="200,180" />
<telerik:RadDiagramConnection Source="{Binding ElementName=Shape1}" Target="{Binding ElementName=Shape2}" />
</telerik:RadDiagram>
<telerik:RadDiagramThumbnail x:Name="xThumbnail"
Grid.Row="1"
Diagram="{Binding ElementName=xDiagram}">
<telerik:RadDiagramThumbnail.ViewportStyle>
<Style TargetType="Rectangle">
<Setter Property="Stroke" Value="Blue" />
</Style>
</telerik:RadDiagramThumbnail.ViewportStyle>
</telerik:RadDiagramThumbnail>
</Grid>''
MainWindow.xaml.cs
private bool isPanning = false;
private Point oldPosition;
private void Diagram_OnPreviewPan(object sender, PositionChangedRoutedEventArgs e)
{
e.Handled = true;
this.isPanning = true;
}
private void diagram_MouseDown(object sender, MouseButtonEventArgs e)
{
this.oldPosition = e.GetPosition(this);
}
private void diagram_MouseUp(object sender, MouseEventArgs e)
{
this.isPanning = false;
}
private void diagram_MouseMove(object sender, MouseEventArgs e)
{
if ((e.LeftButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
{
var position = e.GetPosition(this);
if (this.isPanning && (e.RightButton == MouseButtonState.Pressed || Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
{
RadDiagram diagram = sender as RadDiagram;
double xOffset = position.X - oldPosition.X;
double yOffset = position.Y - oldPosition.Y;
if (yOffset < 0)
{
int visibleHeight = (int)(diagram.DesiredSize.Height / diagram.Zoom);
double pos = diagram.Viewport.Top + visibleHeight;
if (pos - yOffset > diagram.ActualHeight)
{
yOffset += (int)((pos - yOffset) - diagram.ActualHeight);
}
}
else if (yOffset > 0)
{
if (diagram.Viewport.Top - yOffset < 0)
{
//e.Handled = true;
yOffset += (int)diagram.Viewport.Top - yOffset;
}
}
if (xOffset < 0)
{
int visibleWidth = (int)(diagram.DesiredSize.Width / diagram.Zoom);
double pos = diagram.Viewport.Left + visibleWidth;
if (pos - xOffset > diagram.ActualWidth)
{
//e.Handled = true;
xOffset += (int)((pos - xOffset) - diagram.ActualWidth);
}
}
else if (xOffset > 0)
{
if (diagram.Viewport.Left - xOffset < 0)
{
//e.Handled = true;
xOffset += (int)diagram.Viewport.Left - xOffset;
}
}
if (Math.Abs(xOffset) != 0 || Math.Abs(yOffset) != 0)
{
diagram.Position = new Point(diagram.Position.X + xOffset, diagram.Position.Y + yOffset);
}
oldPosition = new Point(oldPosition.X + xOffset, oldPosition.Y + yOffset);
}
}
}

I made a class inherited raddiagramshape class and add "Forename" and "ForenameHorizontalAlignment" to this.
I changed template of SettingsPaneView and I added Horizontal alignment for shape, you can see this in image below.
My template add is
<ListBox Grid.Column="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Left" extensions:SettingsPaneView.EditorPropertyName="ForenameHorizontalAlignment" extensions:SettingsPaneView.EditorItemType="Shapes, Connections" extensions:SettingsPaneView.EditorValue="{Binding Path=SelectedIndex, RelativeSource={RelativeSource Self}, Mode=TwoWay, Converter={StaticResource HorizontalAlignmentConverter}}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBoxItem> <!--Left Alignment--> <Path Width="26" Height="26" Stretch="Fill" Data="M 0,4L 24,4 M 0,10L 12,10 M 0,16L 24,16 M 0,22L 12,22 M 0,28L 24,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z" Stroke="Black" StrokeThickness="1.5"/> </ListBoxItem> <ListBoxItem> <!--Center Alignment--> <Path Width="26" Height="26" Stretch="Fill" Data="M 4,4L 28,4 M 10,10L 22,10 M 4,16L 28,16 M 10,22L 22,22 M 4,28L 28,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z" Stroke="Black" StrokeThickness="1.5"/> </ListBoxItem> <ListBoxItem> <!--Right Alignment--> <Path Width="26" Height="26" Stretch="Fill" Data="M 8,4L 32,4 M 19,10L 32,10 M 8,16L 32,16 M 19,22L 32,22 M 8,28L 32,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z" Stroke="Black" StrokeThickness="1.5"/> </ListBoxItem></ListBox>
and HorizontalAlignmentConverter is
[ValueConversion(typeof(System.Windows.HorizontalAlignment), typeof(int))]public class HorizontalAlignmentConverter : IValueConverter{ #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null) { switch ((int)value) { case 0: return System.Windows.HorizontalAlignment.Left; case 2: return System.Windows.HorizontalAlignment.Right; default: return System.Windows.HorizontalAlignment.Center; } } return System.Windows.HorizontalAlignment.Center; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) return 1; System.Windows.HorizontalAlignment _value = (System.Windows.HorizontalAlignment)value; switch (_value) { case System.Windows.HorizontalAlignment.Left: return 0; case System.Windows.HorizontalAlignment.Right: return 2; default: return 1; } } #endregion}
when I add a shape into diagram and open settingpane I can change horizontal alignment of forename(for example change to left) but when again open sttingpane it show me center. I checked it and I see always Convertback value is null.?
how can I fix it?
I've got a simple RadCartesianChart with two Linear Axes and a scatter line plot. It represents a profile Each axis represents Millimeters. IThat chart auto fits the data to the screen space. I've attached an image to show what it looks like
But now I need to implement a checkbox that will switch the axes to what I am calling "Equal Scale" mode: So that 1 millimeter of my data in vertical space will take up the same physical screen space as 1 millimeter in horizontal space.
Is there a simple way to do this? Some property that I am missing, perhaps? I realize I can try to write the code-behind. but it seems awfully complicated -- I have to take into account the relative ActualWidth/ActualHeight properties of the control as as the relative Millimeter height and width of the data. And I have to make sure that I don't lose my nice even auto labels (or I have do do all the match to individually calculate them myself)
So is there a property/function that will let me achieve this already built in to ChartView?
-Joe
My issue might be similar to this one: https://www.telerik.com/forums/async-await-inside-row-validating-event
I'm wanting to validate by cell, as opposed to by row. Similar to the above, validation works fine when no async calls are made, but progresses as if the validation wasn't there as soon as there is an async call of any sort.
In my case, I'm wanting to use the Cell Validating event not strictly for validation, but rather to provide a prompt to the user and have them answer yes or no before progressing. But I need to be able to run the event with async/await as I am calling async methods.
I can slightly get around this by calling the async methods with in a synchronous-like way, by calling the Wait() method on a Task, for instance. But it is much less convenient to do so.
Is the Telerik UI for WPF library still unable to cope with async validating events like described in the above thread or is there a way to make this situation work?
// This would be preferredpublic async void CellValidating(GridViewCellValidatingEventArgs e){ var result = await this.Dispatcher.InvokeAsync(() => MessageBox.Show("Test", "Test", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes)); if (result == MessageBoxResult.No) { e.IsValid = false; e.ErrorMessage = "This is an error"; }}// This is what I have to do insteadpublic void CellValidating(GridViewCellValidatingEventArgs e){ var op = this.Dispatcher.InvokeAsync(() => MessageBox.Show("Test", "Test", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes)); _ = op.Wait(); var result = op.Result; if (result == MessageBoxResult.No) { e.IsValid = false; e.ErrorMessage = "This is an error"; }}
Hi,
I have built the linked project, but my custom command provider is not being called when I click Finish. Please help.
Here is the link: https://drive.google.com/open?id=1HcYu05M7GAPJOJQqfL_l7FYtEMNwhu8i
Thanks,
Thomas

Hello,
I have project where I need to create a table with 2 Rows
The first row has to be filled with Comboboxes with Options to choose , the second Row I get from a Database.
The ammount of Columns will change every time so i have to do it dynamically
What would be my best approach? i attached a screenshot thats shows what I want

Hi,
I'm having trouble getting list item ("li") element properties ignored using the HtmlFormatProvider export settings. In the following example "h1" properties are ignored correctly, but the "li" ones still come through in the output.
settings.PropertiesToIgnore["h1"].AddRange(new List<string>()
{
"margin-top", "margin-bottom"
});
settings.PropertiesToIgnore["li"].AddRange(new List<string>()
{
"margin-right", "font-family", "font-size", "color"
});
I notice, looking at HtmlDocumentExporter.ExportBlockContainer, that the call to HtmlHelper.IsPropertyForbiddenForExport passes in "value" as the propertykey rather than a css property name (see below). Is that correct or am I doing something wrong here?
this.writer.StartTag("li");
if (!HtmlHelper.IsPropertyForbiddenForExport(this.Settings, "li", "value"))
{
HtmlWriter htmlWriter = this.writer;
int listItemIndex = this.GetDocumentListForParagraph(paragraph).GetListItemIndex(paragraph);
htmlWriter.AddAttribute("value", listItemIndex.ToString());
}
Many thanks
John
I've long been showing a ScatterLineSeries on my RadCartesianChart that uses a MultiBinding in the ItemsSource. I needed this multibinding because the underlying points are expressed in millimeters but the display can be in any units the user chooses and which the user can change. So I have to convert on the fly. So I wrote a converter that takes 5 elements
It then returns an array of points converted to the appropriate units. This works fine. It looks like this:
<tk:RadCartesianChart.Series> <tk:ScatterLineSeries XValueBinding="X" YValueBinding="Y"> <tk:ScatterLineSeries.ItemsSource> <MultiBinding Converter="{core:PointsLengthConverter}"> <Binding Path="ProfilePoints" /> <Binding Path="SystemService.Millimeter" /> <!-- Source X Unit --> <Binding Path="SystemService.Millimeter" /> <!-- Source Y Unit --> <Binding ElementName="Root" Path="LengthAxisUnit" /> <!-- Dest X Unit --> <Binding ElementName="Root" Path="HeightAxisUnit" /> <!-- Dest Y Unit --> </MultiBinding> </tk:ScatterLineSeries.ItemsSource> </tk:ScatterLineSeries></tk:RadCartesianChart.Series>
However now I need to show several plots on this graph, not just one. But the number varies. So I need to use a ChartSeriesProvider. So I did, with a ScatterSeriesDescriptor. At first it seemed to work -- I got my points -- but then I realized that it iis not converting my points anymore. It is completely ignoring my "ItemsSource" binding in favor the of the "ItemsSourcePath" property in the descriptor.
Here's what it looks like: First I defined a style for each ScatterLineSeries
<Style x:Key="SeriesStyle" TargetType="{x:Type tk:ScatterLineSeries}">
<d:Style.DataContext> <x:Type Type="core:IProfile" /> </d:Style.DataContext> <Setter Property="ItemsSource"> <Setter.Value> <MultiBinding Converter="{core:PointsLengthConverter DebugMode=True}"> <Binding Path="ProfilePoints" /> <Binding Source="{x:Static sdk:LengthUnit.Millimeter}" /> <!-- Source X Unit --> <Binding Source="{x:Static sdk:LengthUnit.Millimeter}" /> <!-- Source Y Unit --> <Binding ElementName="Root" Path="LengthAxisUnit" /> <!-- Dest X Unit --> <Binding ElementName="Root" Path="HeightAxisUnit" /> <!-- Dest Y Unit --> </MultiBinding> </Setter.Value> </Setter></Style>
Then, inside chart, I defined the seriesprovider and descriptor and used that style in it:
<tk:RadCartesianChart.SeriesProvider> <tk:ChartSeriesProvider Source="{Binding Profiles}"> <tk:ChartSeriesProvider.SeriesDescriptors> <tk:ScatterSeriesDescriptor XValuePath="X" YValuePath="Y" ItemsSourcePath="Points" Style="{StaticResource SeriesStyle}"> </tk:ScatterSeriesDescriptor> </tk:ChartSeriesProvider.SeriesDescriptors> </tk:ChartSeriesProvider></tk:RadCartesianChart.SeriesProvider>
Again, this mostly works. My points get plotted. My "SeriesStyle" even gets applied to the ScatterLineSeries (e.g. If I set the stroke to "Yellow" in that style, I see a yellow plotline). But the final element of that style -- ItemsSource -- does NOT get applied. I've tried putting a breakpoint inside the converter. It never gets invoked. So my points all remain in millimeters.
I took a closer look at ScatterSeriesDescriptor, hoping I could find a property that would let me achieve my MultiBinding. I see XValuePath, YValuePath and ItemsSourcePath, and a few other properties ("TypeConverter", "TypePath", etc) but I cannot see any way to apply a MultiBinding to the series of points.
Can you suggest a way I can work around this?