Hi
I’m trying to get keyboard shortcuts to work inside several tab items. However, keyboard shortcuts only work after you click on something/anything inside of the tab. Clicking on the Tab header is not enough.
I have tried focusing on the first child in code when the tab is selected but that doesn’t work, it's only after a mouse click inside the tab that it starts to work.
<telerik:RadTabItem Header="Item X" >
<telerik:RadTabItem.InputBindings>
<KeyBinding Key="N" Modifiers="Ctrl" Command="{Binding NewItemXCommand}" />
<KeyBinding Key="R" Modifiers="Ctrl" Command="{Binding ReloadItemXCommand}" />
</telerik:RadTabItem.InputBindings>
<Grid>
<!-- Content -->
</Grid>
</telerik:RadTabItem>
<telerik:RadTabItem Header="Item Y" >
<telerik:RadTabItem.InputBindings>
<KeyBinding Key="N" Modifiers="Ctrl" Command="{Binding NewItemYCommand}" />
<KeyBinding Key="R" Modifiers="Ctrl" Command="{Binding ReloadItemYCommand}" />
</telerik:RadTabItem.InputBindings>
<Grid>
<!-- Content -->
</Grid>
</telerik:RadTabItem>
Any advice you can offer would be appreciated.
Thanks,
Richard

I have created an application in which user can draw RadDiagramShapes on an Image which is again a RadDiagramShape, an image is just set on the content of the shape.
When i am connecting two shapes with RadDiagramConnection it is present in the list but i am not able to see those connections.
When i create these connections without the image in the background the connections will show.
Can someone please help me how can i see the connections with background image on?
Hi all!
This question is not accurate enough, the actual problem is described here: https://www.telerik.com/forums/radtoolbartray-itemtemplateselector-problems
***
I have not updated my Telerik components for years; last time I did, the radToolbars stopped working, and I have not had the time to look into it. So I reverted back to what worked, but now I feel it's time to get back on the track.
So here we go: programmatically generated toolbars on my main form do not display any buttons. I use toolbar and button view models that the UI components bind to. The entire set of toolbar viewmodels are built on the fly, and only empty toolbars show up. I have other UI components which have buttonless toolbar components placed onto them at design time, and those work when I add the buttons runtime, so the only difference I've found has to do with the non-working toolbars not existing at design time.
They work in RCWPF 2018.3.1016.45, so that's what I'm still using. This happened when I (briefly) upgraded to 2020.2.513.45, and the problem still exists in the current version.
The images show the two different versions. The dockable Conceptual model window contains an empty-at-design-time toolbar, which is populated when the UI is initialized. The main window contains a toolbar container which does not contain any toolbar components at design time.
Does anything come to mind immediately? If not, I will dig into my code.
And to be clear, the generated toolbarviewmodel has several buttonviewmodels on it. The same code builds the viewmodels in both cases.
Hi!
I have my own toolbar class, derived directly from RadToolbar:
<telerik:RadToolBar x:Class="MyNS.Components.MyToolbar"
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:viewmodel="clr-namespace:MyNS.ViewModel;assembly=MyNS.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:ToolbarViewModel}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
VerticalAlignment="Top"
DataContext="{Binding}"
Visibility="{Binding ToolbarVisible, Converter={StaticResource BoolToVisibility}}"
ItemTemplateSelector="{StaticResource ToolbarElementTemplateSelector}"
ItemsSource="{Binding Elements}"
Band="{Binding Band}"
BandIndex="{Binding BandIndex}"
>
</telerik:RadToolBar>
with
public partial class MyToolbar : RadToolBar
{
public MyToolbar()
{
InitializeComponent();
}
}
When I add this toolbar design time on my child forms it works nicely. The underlying ToolbarViewModel binds all the way, and I get the buttons I want when I run the app.
But when dynamically instantiating new ToolbarViewModels to be shown on my MainWindow, I get empty buttonless RadToolbar instances, not MyToolbar instances. So I want to control what kind of toolbar gets instantiated. I have this in MainWindow.xaml:
<telerik:RadWindow x:Class="MyNS.MainWindow"
...
<telerik:RadToolBarTray
Name="Toolbars"
Grid.Row="1"
ItemsSource="{Binding Path=Toolbars}"
IsLocked="False"
ItemTemplateSelector="{StaticResource ToolbarTemplateSelector}"
/>
</telerik:RadWindow>
The binding itself works. I get RadToolbars, but without any buttons on them. But I get the wrong kind of toolbar, and I thought the ToolbarTemplateSelector would do it, but it never gets called.
So I have:
public class ToolbarTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
// currently only one toolbar template
// THIS CODE IS NEVER RUN
return this.MyToolbarTemplate;
}
public DataTemplate MyToolbarTemplate { get; set; }
}
and DataTemplate.xaml
<ResourceDictionary
...
<!-- compile error if removed, so the mainwindow reference correctly points to this -->
<vm:ToolbarTemplateSelector
x:Key="ToolbarTemplateSelector"
MyToolbarTemplate="{StaticResource dtMyToolbar}"
/>
</ResourceDictionary>
and in PaneTemplate.xaml I have:
<ResourceDictionary
...
<!-- app crashes on start if this is removed -->
<DataTemplate x:Key="dtMyToolbar" DataType="{x:Type vm:ToolbarViewModel}">
<components:MyToolbar />
</DataTemplate>
</ResourceDictionary>
In my mind, whenever a new ToolbarViewModel is added to the Toolbars collection, the ToolbarTemplateSelector should instantiate a MyToolbar instance for it, and not a RadToolbar instance.
I have no idea what's missing.
Oh, I also tested with:
<telerik:RadWindow x:Class="MyNS.MainWindow"
...
<telerik:RadToolBarTray
Name="Toolbars"
Grid.Row="1"
ItemsSource="{Binding Path=Toolbars}"
IsLocked="False"
>
<DataTemplate>
<ksc:MyToolbar/>
</DataTemplate>
</telerik:RadToolBarTray>
...
</telerik:RadWindow>
But then the app crashes with the error message "Items collection must be empty before using ItemsSource." before the main window shows up. I don't see why that would happen, as the toolbartray is definitely empty at first.
Appreciate any help,
Kim
Hi,
I'm using RadMap to load a simple ESRI shapefile containing points (described by latitude/longitude in associated dbf file).
I want to change the defaut icon used to draw the point (which is looking like a google map pin) to a single blue circle with a radius of one ou two pixel.
I want to change the color of the circle on mouse click for select it.
I tried to use VisualizationLayer.ShapeFill but it doesn't work.
Here is my code :
<UserControl x:Class="Example" xmlns:local="clr-namespace:POCMap" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <UserControl.Resources> </UserControl.Resources> <DockPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center"> <Button Click="France_OnClick">France</Button> <Button Click="Roumanie_OnClick">Roumanie</Button> <Button Click="Yenne_OnClick">Yenne</Button> </StackPanel> <Grid DockPanel.Dock="Bottom"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <TextBlock Grid.Row ="0" Grid.Column="0">Latitude (°N)</TextBlock> <TextBox Grid.Row ="0" Grid.Column="1" x:Name="txtLatitude" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox> <TextBlock Grid.Row ="1" Grid.Column="0">Longitude (°E)</TextBlock> <TextBox Grid.Row ="1" Grid.Column="1" x:Name="txtLongitude" LostFocus="TxtLatitudeLongitude_OnLostFocus" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox> </Grid> <telerik:RadBusyIndicator Name="busyIndicator"> <telerik:RadMap x:Name="radMap" Center="40,-100" ZoomLevel="8" > <telerik:RadMap.Provider> <telerik:ArcGisMapProvider x:Name="prov" Mode="Aerial" /> </telerik:RadMap.Provider> <!--<telerik:InformationLayer x:Name="informationLayer"/>--> <telerik:VisualizationLayer x:Name="visualizationLayer" UseBitmapCache="False"> <telerik:VisualizationLayer.ZoomLevelGridList> <telerik:ZoomLevelGrid MinZoom="0" /> <telerik:ZoomLevelGrid MinZoom="9" /> <telerik:ZoomLevelGrid MinZoom="8" /> </telerik:VisualizationLayer.ZoomLevelGridList> <telerik:VisualizationLayer.ShapeFill> <telerik:MapShapeFill Fill="#6FDFEFFF" Stroke="Blue" StrokeThickness="2" /> </telerik:VisualizationLayer.ShapeFill> <telerik:VisualizationLayer.VirtualizationSource> <telerik:MapShapeDataVirtualizationSource x:Name="mapShapeDataVirtualizationSource"> <telerik:MapShapeDataVirtualizationSource.Reader> <!--<telerik:AsyncShapeFileReader Source="/POCMap;component/Resources/Time_Zones.shp" ToolTipFormat="Time Zone : {ZONE_}" /> --> <telerik:AsyncShapeFileReader x:Name="mapShapeDataReader" ToolTipFormat="Latitude : {latitude} / Longitude : {longitude}" ProgressChanged="OnProgressChanged" ReadShapeDataCompleted="OnReadShapeDataCompleted"/> </telerik:MapShapeDataVirtualizationSource.Reader> </telerik:MapShapeDataVirtualizationSource> </telerik:VisualizationLayer.VirtualizationSource> </telerik:VisualizationLayer> </telerik:RadMap> </telerik:RadBusyIndicator> </DockPanel></UserControl>
Imports System.Windows.ResourcesImports Telerik.Windows.Controls.MapPublic Class Example Public Sub New() ' Cet appel est requis par le concepteur. InitializeComponent() AddHandler Me.Loaded, AddressOf Page_Loaded ' Ajoutez une initialisation quelconque après l'appel InitializeComponent(). prov.Mode = ArcGisMapMode.Topographic radMap.Center = New Location(45.7, 5.75) radMap.ZoomLevel = 8 radMap.MaxZoomLevel=8 txtLatitude.Text = 45.7 txtLongitude.Text = 5.75 AddHandler Me.Loaded, AddressOf Me.ExampleLoaded End Sub Private Sub Page_Loaded(sender As Object, e As RoutedEventArgs) Me.mapShapeDataVirtualizationSource.ReadAsync() End Sub Private Sub TxtLatitudeLongitude_OnLostFocus(sender As Object, e As RoutedEventArgs) SetLocation() End Sub Private Sub TxtLatitudeLongitude_OnKeyDown(sender As Object, e As KeyEventArgs) If e.Key = Key.Enter Then SetLocation() End If End Sub Private Sub SetLocation() If txtLatitude.Text AndAlso txtLongitude.Text Then Dim latitude = CDbl(txtLatitude.Text) Dim longitude = CDbl(txtLongitude.Text) radMap.Center = New Location(latitude, longitude) End If End Sub Private Sub France_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(47.08, 2.39) radMap.ZoomLevel = 6 End Sub Private Sub Roumanie_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(44.94, 26.96) radMap.ZoomLevel = 6 End Sub Private Sub Yenne_OnClick(sender As Object, e As RoutedEventArgs) radMap.Center = New Location(45.7, 5.75) radMap.ZoomLevel = 13 End Sub Private Sub ExampleLoaded(sender As Object, e As RoutedEventArgs) Me.busyIndicator.IsIndeterminate = False Me.busyIndicator.IsBusy = True Me.mapShapeDataReader.Source = New Uri("/POCMap;component/Resources/0.25deg_grille_EU.shp", UriKind.Relative) End Sub Private Sub OnProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Me.busyIndicator.ProgressValue = e.ProgressPercentage If e.ProgressPercentage >= 100 Then Me.busyIndicator.IsIndeterminate = True Me.busyIndicator.BusyContent = "Refresh layer" End If End Sub Private Sub OnReadShapeDataCompleted(sender As Object, e As Telerik.Windows.Controls.Map.ReadShapeDataCompletedEventArgs) If Me.busyIndicator IsNot Nothing Then Me.busyIndicator.IsBusy = False End If End SubEnd Class
Thanks for your help
Yoan
Hellp
In the previous post I asked a question and got an answer..
But there was a problem.
It is related to number 1. ( https://www.telerik.com/forums/is-a-custom-color-picker-possible )
It runs fine until the build is successful and I start debugging and finish.
Using <Setter Property = "local : CustomColorPickerOpenBehavior"Value = "True"/> crashes the designer.
Where xaml designer Exception was thrown.
InvalidOperationException: Sequence contains no matching element
Deleting the CustomColorPickerOpenBehavior property shows the xaml designer.
If the property is created again, an exception occurs.
What is the problem?
Thanks.
<Style TargetType="telerik:RadColorPicker" BasedOn="{StaticResource RadColorPickerStyle}">
<Setter Property="Padding" Value="5" />
<Setter Property="SplitButtonStyle">
<Setter.Value>
<Style TargetType="telerik:RadSplitButton" BasedOn="{StaticResource RadSplitButtonStyle}">
<Setter Property="mat:MaterialAssist.FocusBrush" Value="Transparent"/>
<Setter Property="mat:MaterialAssist.MouseOverBrush" Value="Transparent"/>
<Setter Property="behaviour:ColorPickerButtonSync.IsEnabled" Value="True" />
<Setter Property="IsChecked" Value="{Binding IsDropDownOpen, RelativeSource={RelativeSource AncestorType=telerik:RadColorPicker}}" />
</Style>
</Setter.Value>
</Setter>
</Style><telerik:RadColorPicker Width="70" SelectedColor="Red" IsRecentColorsActive="True">
<telerik:RadColorPicker.ContentTemplate>
<DataTemplate>
<Rectangle Width="35" Height="25"
Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadColorPicker}},
Path=SelectedColor, Converter={StaticResource mediaToBrushConverter}}" />
</DataTemplate>
</telerik:RadColorPicker.ContentTemplate>
<telerik:RadColorPicker.AdditionalContent>
<ContentControl HorizontalContentAlignment="Stretch" Content="{Binding}" >
<ContentControl.ContentTemplate>
<DataTemplate>
<Grid>
<telerik:RadButton Height="26" BorderThickness="0"
HorizontalContentAlignment="Left"
Command="{Binding OnClickOpenEditColorsCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type telerik:RadColorPicker}}}"
>
<telerik:RadButton.Content>
<TextBlock Text="More Colors..." Margin="26 0 0 0" />
</telerik:RadButton.Content>
</telerik:RadButton>
</Grid>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</telerik:RadColorPicker.AdditionalContent>
</telerik:RadColorPicker>
public class ColorPickerButtonSync
{
public static bool GetIsEnabled(DependencyObject obj)
{
return (bool)obj.GetValue(IsEnabledProperty);
}
public static void SetIsEnabled(DependencyObject obj, bool value)
{
obj.SetValue(IsEnabledProperty, value);
}
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ColorPickerButtonSync), new PropertyMetadata(false, new PropertyChangedCallback(OnIsEnabledChanged)));
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var button = d as RadSplitButton;
button.IsToggle = true;
button.Loaded += Button_Loaded;
button.Checked += SplitButton_Checked;
button.Unchecked += SplitButton_Unchecked;
button.DropDownOpened += Button_DropDownOpened;
button.DropDownClosed += Button_DropDownClosed;
}
private static void Button_Loaded(object sender, RoutedEventArgs e)
{
var splitButton = sender as RadSplitButton;
var colorSelector = splitButton.DropDownContent as RadColorSelector;
colorSelector.Loaded += (s, a) =>
{
var rootElement = colorSelector.ChildrenOfType<Grid>().First(x => x.Name == "RootElement");
Grid.SetRow(rootElement.Children[1], 4);
Grid.SetRow(rootElement.Children[2], 5);
Grid.SetRow(rootElement.Children[3], 6);
Grid.SetRow(rootElement.Children[4], 1);
Grid.SetRow(rootElement.Children[5], 2);
Grid.SetRow(rootElement.Children[6], 3);
};
var dropDownPart = splitButton.ChildrenOfType<RadToggleButton>().First(x => x.Name == "DropDownPart");
var rectangle = splitButton.ChildrenOfType<Rectangle>().First(x => x.Name == "Separator");
//System.InvalidOperationException: 'Sequence contains no matching element'
dropDownPart.Visibility = Visibility.Collapsed;
rectangle.Visibility = Visibility.Collapsed;
}
private static void Button_DropDownClosed(object sender, RoutedEventArgs e)
{
var splitButton = sender as RadSplitButton;
splitButton.IsChecked = false;
}
private static void Button_DropDownOpened(object sender, RoutedEventArgs e)
{
var splitButton = sender as RadSplitButton;
splitButton.IsChecked = true;
}
private static void SplitButton_Checked(object sender, RoutedEventArgs e)
{
var splitButton = sender as RadSplitButton;
var colorPicker = splitButton.ParentOfType<RadColorPicker>();
colorPicker.IsDropDownOpen = true;
}
private static void SplitButton_Unchecked(object sender, RoutedEventArgs e)
{
var splitButton = sender as RadSplitButton;
var colorPicker = splitButton.ParentOfType<RadColorPicker>();
colorPicker.IsDropDownOpen = false;
}
}
how to display image from arcgis server which provider i have to used ?
i want display one image not many tiles from arcgis server
a)tilemadsource,
b)imagemapsource,
c)UriImageProvider
d)another?
please i want a code.

I want to display attached properties in PropertyGrid.
How to.
