Hello,
I am trying to create a Diagram, using RadDiagram, and I want to apply some custom styles using StyleSelectors.
My main issue is that when I apply a ShapeStyle to a RadDiagram (even static) then the shapes disappear!The same happens with the connections.
Even the simplest examples from Customize the RadDiagramShape Style do not work! I use Telerik 2017.3.1018.45.NoXaml version and I have added the following dictionaries:
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Summer;component/Themes/System.Windows.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Summer;component/Themes/Telerik.Windows.Controls.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Summer;component/Themes/Telerik.Windows.Controls.Diagrams.xaml"
/>
My MainWindow.Xaml
<
Window
x:Class
=
"TestingDiagram.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:TestingDiagram"
mc:Ignorable
=
"d"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.Resources
>
<
Style
TargetType
=
"telerik:RadDiagramShape"
x:Key
=
"CustomShapeStyle"
>
<
Setter
Property
=
"Background"
Value
=
"LightGreen"
/>
<
Setter
Property
=
"FontWeight"
Value
=
"Bold"
/>
</
Style
>
</
Grid.Resources
>
<
telerik:RadDiagram
x:Name
=
"xDiagram"
ShapeStyle
=
"{StaticResource CustomShapeStyle}"
>
<
telerik:RadDiagramShape
x:Name
=
"shape1"
Position
=
"20,20"
Content
=
"Shape 1"
/>
<
telerik:RadDiagramShape
x:Name
=
"shape2"
Position
=
"220,20"
Content
=
"Shape 2"
/>
<
telerik:RadDiagramConnection
Source
=
"{Binding ElementName=shape1}"
Target
=
"{Binding ElementName=shape2}"
/>
</
telerik:RadDiagram
>
</
Grid
>
</
Window
>
Thanks in advance
Dimitris
when drag an outer gridSplitter the gridview display incomplete
the step is
1. drag the gridview's scrollbar to bottom
2. drag up the red gridSplitter
3. then the gridview display incomplete
my code is as follows
<Window x:Class="RadComboBoxStyling.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:example="clr-namespace:RadComboBoxStyling"
Title="MainWindow"
WindowState="Maximized">
<Window.Resources>
<example:AgencyViewModel x:Key="DataSource" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GridSplitter Height="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Background="Red"
ShowsPreview="True" />
<telerik:RadTabControl Grid.Row="1">
<telerik:RadTabItem>
<telerik:RadGridView ItemsSource="{Binding Source={StaticResource DataSource}, Path=TestData}" />
</telerik:RadTabItem>
</telerik:RadTabControl>
</Grid>
</Window>
class AgencyViewModel
{
public AgencyViewModel()
{
TestData = new DataTable();
testData.Columns.Add(new DataColumn { ColumnName = "aa" });
testData.Columns.Add(new DataColumn { ColumnName = "bb" });
for (int i = 0; i < 10; i++)
{
testData.Rows.Add(new string[] { "testaa" + i, "testbb" + i });
}
}
private DataTable testData;
public DataTable TestData
{
get { return testData; }
set { testData = value; }
}
}
My diagram size is fixed.
When the items is many(over 100 or more), then i layout the diagram
SugiyamaSettings settings = new SugiyamaSettings()
{
VerticalDistance = 10d,
HorizontalDistance = 5d,
};
transDiagram.Layout(LayoutType.Sugiyama, settings);
some items is out of the diagram
How to let the items inner the diagram when items is horizontal or vertical overflow
Hi,
I created a behavior to scroll to the selected item in a RadGridView when the selected item is set programmatically. Basically, I used Dan's answer in this post: https://www.telerik.com/forums/scroll-to-row-when-programmatically-setting-selected-item.
This works fine when applying the behavior directly to the grid as in following example
<telerik:RadGridView Grid.Column="2" ItemsSource="{Binding StockSvtCollectionView}" SelectedItem="{Binding CurrentModel}" GroupRenderMode="Flat" AutoGenerateColumns="False" IsReadOnly="True" ShowGroupFooters="True" ShowColumnFooters="True" AutoExpandGroups="True" Margin="0,-10,0,10">
<i:Interaction.Behaviors>
<uct:RadGridViewScrollSelectedItemIntoViewBehavior/>
</i:Interaction.Behaviors>
Now I'm looking for an easy way to apply this behvior to all my GridViews. I tried using a style:
<Style x:Key="DefaultTelerikGridView" TargetType="{x:Type telerik:RadGridView}">
<Style.Setters>
<Setter Property="i:Interaction.Behaviors">
<Setter.Value>
<uct:RadGridViewScrollSelectedItemIntoViewBehavior/>
</Setter.Value>
</Setter>
<Setter Property="telerik:StyleManager.Theme" Value="{StaticResource DefaultTelerikApplicationTheme}"/>
</Style.Setters>
</Style>
<Style TargetType="{x:Type telerik:RadGridView}" BasedOn="{StaticResource DefaultTelerikGridView}"/>
But this generates this error:
The property "Behaviors" is not a DependencyProperty. To be used in markup, non-attached properties must be exposed on the target type with an accessible instance property "Behaviors". For attached properties, the declaring type must provide static "GetBehaviors" and "SetBehaviors"
Any help would be much appreciated.
Hi..
I have an app, that have been using the maps perfectly for several years.
Now, I get an Empty Map - No Roads nothing!
I'm using the BING provider.
Any ideas? Help!!
Hi,
How can I use the ExportToImage extension with define the size (Width and Height) of the image. I do not wish to change the size of my framework element (RadCartesianChart ) in so that the image generated will be bigger in size.
This is the line of code to export to image:
Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(CartesianChart, Path.GetFullPath(fileName), new PngBitmapEncoder());
Thanks in advanced.
Regards,
CS
When call Layout with SugiyamaSettings ,I wish to display the shapes from right to left ,root node dock at the right side
SugiyamaSettings settings = new SugiyamaSettings()
{
VerticalDistance = 10d,
HorizontalDistance = 5d,
IgnoreInvisible = true,
ComponentsGridWidth = transDiagram.ActualWidth,
Orientation = Telerik.Windows.Diagrams.Core.Orientation.Vertical,
};
transDiagram.Layout(layoutType, settings);
how to do?