Telerik Forums
UI for WPF Forum
3 answers
235 views
I am evaluating the DevCraft suite for WPF, and I've run into an odd problem.  

I'm developing an internal application for my company.  It uses .NET 4.5, WPF, Prism, and Entity Framework 5.0.

When I instantiate a RadTreeView control and populate it with static RadTreeViewItem objects in the XAML, it doesn't display.  If I set the background color, I get a colored rectangle with no items.  Using Snoop I can see that it exists in the visual tree and the HasItems property is true.  This behavior is the same regardless of whether I navigate to a region using Prism or declare it manually in the shell window.

If I create a separate application and place the static test RadTreeView in it, it behaves as expected.

Any ideas?

Thanks!
Martin Ivanov
Telerik team
 answered on 13 Jun 2017
6 answers
199 views

Hello. First, I apologize for the fact that I can seem somewhat intrusive. I want to use RadTileView for real-time charts displaying. For example, if I need the folowing RadCartesianChart (please see 'SensorsSignals.PNG' file attached and XAML markup below)

<telerik:RadCartesianChart x:Name="chart1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" EmptyContent="{Binding ChartEmptyContent}">
   <!--Turn scrollbar visualization off-->
   <telerik:RadCartesianChart.Resources>
      <Style TargetType="telerik:PanZoomBar">
         <Setter Property="Visibility" Value="Collapsed"/>
       </Style>
   </telerik:RadCartesianChart.Resources>
   <!--X axis-->
   <telerik:RadCartesianChart.HorizontalAxis>
      <telerik:CategoricalAxis LabelInterval="6"/>
   </telerik:RadCartesianChart.HorizontalAxis>
   <!--Y axis-->
   <telerik:RadCartesianChart.VerticalAxis>
     <telerik:LinearAxis Minimum="-128" Maximum="127" MajorStep="8" />
   </telerik:RadCartesianChart.VerticalAxis>
   <!--Chart curve itself-->
   <telerik:SplineSeries CategoryBinding="Item1" ValueBinding="Item2" ItemsSource="{Binding SensorData}" Style="{StaticResource SplineSeriesStyle}"/>
   <!--Layout grid-->
   <telerik:RadCartesianChart.Grid>
     <telerik:CartesianChartGrid MajorLinesVisibility="XY" StripLinesVisibility="XY" IsTabStop="False">
        <telerik:CartesianChartGrid.YStripeBrushes>
           <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
           <SolidColorBrush Color="Transparent" />
        </telerik:CartesianChartGrid.YStripeBrushes>
        <telerik:CartesianChartGrid.XStripeBrushes>
           <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
           <SolidColorBrush Color="Transparent" />
        </telerik:CartesianChartGrid.XStripeBrushes>
     </telerik:CartesianChartGrid>
   </telerik:RadCartesianChart.Grid>
   <!--Behaviors of the chart-->
   <telerik:RadCartesianChart.Behaviors>
     <telerik:ChartPanAndZoomBehavior DragMode="Pan" ZoomMode="Both" PanMode="Both"/>
   </telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>

According to your 'DataBinding_WPF' program example and 'Data Binding' paper in http://docs.telerik.com/devtools/wpf/controls/radtileview/populating-with-data/populating-binding-to-collection I do the folowing steps.

1) In the View I write such markup:

<UserControl x:Class="UltrasonicSensors.Views.UltrasonicSensorsView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:prism="http://prismlibrary.com/"            
             prism:ViewModelLocator.AutoWireViewModel="True">
 
    <FrameworkElement.Resources>
        <!--Curve thickness and color style-->
        <Style x:Key="SplineSeriesStyle" TargetType="telerik:SplineSeries" BasedOn="{StaticResource SplineSeriesStyle}">
            <Setter Property="Stroke" Value="RoyalBlue"/>
            <Setter Property="StrokeThickness" Value="3"/>
        </Style>
        <DataTemplate x:Key="ItemTemplate">
            <TextBlock Text="{Binding ChartCaption}" />
        </DataTemplate>
        <!--Template of sensor signal chart-->
        <DataTemplate x:Key="ContentTemplate">
            <telerik:RadCartesianChart x:Name="chart1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" EmptyContent="{Binding ChartEmptyContent}">
                <!--Turn scrollbars off-->
                <telerik:RadCartesianChart.Resources>
                    <Style TargetType="telerik:PanZoomBar">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </Style>
                </telerik:RadCartesianChart.Resources>
                <!--X axis-->
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:CategoricalAxis LabelInterval="6"/>
                </telerik:RadCartesianChart.HorizontalAxis>
                <!--Y axis-->
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis Minimum="-128" Maximum="127" MajorStep="8" />
                </telerik:RadCartesianChart.VerticalAxis>
                <!--Chart curve itself-->
                <telerik:SplineSeries CategoryBinding="Item1" ValueBinding="Item2" ItemsSource="{Binding SensorData}" Style="{StaticResource SplineSeriesStyle}"/>
                <!--Layout grid-->
                <telerik:RadCartesianChart.Grid>
                    <telerik:CartesianChartGrid MajorLinesVisibility="XY" StripLinesVisibility="XY" IsTabStop="False">
                        <telerik:CartesianChartGrid.YStripeBrushes>
                            <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
                            <SolidColorBrush Color="Transparent" />
                        </telerik:CartesianChartGrid.YStripeBrushes>
                        <telerik:CartesianChartGrid.XStripeBrushes>
                            <SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
                            <SolidColorBrush Color="Transparent" />
                        </telerik:CartesianChartGrid.XStripeBrushes>
                    </telerik:CartesianChartGrid>
                </telerik:RadCartesianChart.Grid>
                <!--Behaviors-->
                <telerik:RadCartesianChart.Behaviors>
                    <telerik:ChartPanAndZoomBehavior DragMode="Pan" ZoomMode="Both" PanMode="Both"/>
                </telerik:RadCartesianChart.Behaviors>
            </telerik:RadCartesianChart>
        </DataTemplate>
    </FrameworkElement.Resources>
 
    <Grid>
        <!--Sensors signals charts:-->
        <telerik:RadTileView x:Name="xTileView" Grid.Row="0" Grid.Column="0" PreservePositionWhenMaximized="True" MinimizedColumnWidth="150"
                             ItemTemplate="{StaticResource ItemTemplate}"
                             ContentTemplate="{StaticResource ContentTemplate}"
                             ItemsSource="{Binding SensorSignalCharts}">
        </telerik:RadTileView>
    </Grid>
</UserControl>

In the ViewModel I write something similar to the following code in C# (note!!! this code here for STUBS but not for real ultrasonic signals!!!):

/// <summary>
/// ViewModel of charts of STUBS for signals of ultrasonic sensors.
/// </summary>
public class UltrasonicSensorsViewModel : BindableBase, IConfirmNavigationRequest
{
    #region Fields
     
    #region Constant Fields
    /// <summary>
    ///  Message about mising of chart data.
    /// </summary>
    private const string NO_DATA_FOR_CHART = "Нет данных для построения графика";
    /// <summary>
    /// Number of points to build a chart.
    /// </summary>
    private const int CHART_POINTS_QUANTITY = 180;
    #endregion
 
    #region Common Variable Fields
    /// <summary>
    /// Collection of View Models of sensor signal chart.
    /// </summary>
    private RadObservableCollection<SensorSignalChartViewModel> _sensorSignalCharts;
    #endregion
 
    #endregion
 
    #region Constructors
 
    public UltrasonicSensorsViewModel()
    {
        // Data for constructing a sinusoidal STUB chart.
        byte[] aDummyData = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
                0x01, 0x00, 0x00, 0xFE, 0xFE, 0xFF, 0x00, 0x01, 0x03, 0x02, 0x01, 0x00, 0xFD, 0xFC, 0xFD, 0x00, 0x04, 0x06, 0x07, 0x03, 0xFD, 0xF7, 0xF3, 0xF6,
                0x00, 0x0B, 0x14, 0x15, 0x0C, 0xFC, 0xEA, 0xDF, 0xE2, 0xF4, 0x0E, 0x26, 0x2F, 0x24, 0x07, 0xE4, 0xCA, 0xC6, 0xDB, 0x01, 0x2B, 0x44, 0x41, 0x22,
                0xF3, 0xC8, 0xB4, 0xBF, 0xE6, 0x18, 0x41, 0x4E, 0x3B, 0x10, 0xE0, 0xBE, 0xB8, 0xCF, 0xF9, 0x23, 0x3E, 0x3E, 0x26, 0x01, 0xDF, 0xCD, 0xCF, 0xE5,
                0x01, 0x1A, 0x27, 0x23, 0x13, 0x00, 0xEF, 0xE7, 0xE9, 0xF2, 0xFE, 0x08, 0x0D, 0x0E, 0x0B, 0x06, 0x01, 0xFD, 0xF9, 0xF6, 0xF6, 0xF8, 0xFD, 0x03,
                0x0A, 0x0E, 0x0D, 0x07, 0xFF, 0xF5, 0xF0, 0xF0, 0xF7, 0x00, 0x0A, 0x10, 0x0E, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
        // Create the collection of View Models of sensor signal chart.    
        this.SensorSignalCharts = new RadObservableCollection<SensorSignalChartViewModel>();
        // Create array of chart points.
        Tuple<int, double>[] aSensorData = new Tuple<int, double>[CHART_POINTS_QUANTITY];
        sbyte[] aSignedDummyData = Array.ConvertAll(aDummyData, b => unchecked((sbyte)b));
        for (int i = 0; i < aSignedDummyData.Length; i++)
            aSensorData[i] = new Tuple<int, double>(i, aSignedDummyData[i]);
        // Populate all displayed charts with data.
        SensorSignalChartViewModel sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от первого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от второго сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от третьего сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от четвёртого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от пятого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от шестого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от седьмого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
        sscm = new SensorSignalChartViewModel(aSensorData);
        sscm.ChartCaption = "График сигнала от восмого сенсора";
        sscm.ChartEmptyContent = NO_DATA_FOR_CHART;
        this.SensorSignalCharts.Add(sscm);
    }
 
    #endregion
 
    #region Properties
 
    /// <summary>
    /// Gets or sets Collection of View Models of sensor signal chart.
    /// </summary>
    public RadObservableCollection<SensorSignalChartViewModel> SensorSignalCharts
    {
        get { return this._sensorSignalCharts; }
        set { this.SetProperty(ref this._sensorSignalCharts, value); }
    }
 
    #endregion
}

All works OK here. BUT. If I need to locate inside the block of

<FrameworkElement.Resources>
  . . . . . . . . . . . . . . . . . .
</FrameworkElement.Resources>

a XAML markup which contains <UserControl.Resources>...</UserControl.Resources> blocks and <i:Interaction.Triggers>...</i:Interaction.Triggers> blocks then how WPF will behave itself in this case? Will she allow such markup or not? As far as I know, it's impossible to place one <.Resource> tag inside another <.Resource> tag. So, what I can do in this case? Below is XAML markup which I need to locate inside <FrameworkElement.Resource></FrameworkElement.Resource> tag. For clarity, I show it inside <UserControl></UserControl> tag as I've done it in the application.

<UserControl x:Class="DeviceReading.Views.t_GasVelocityPerBeamView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:local="clr-namespace:DeviceReading"
             xmlns:views="clr-namespace:DeviceReading.Views"
             xmlns:commonControls="clr-namespace:CommonWpfControlLibrary;assembly=CommonWpfControlLibrary"
             prism:ViewModelLocator.AutoWireViewModel="True">   
     
    <UserControl.Resources>
        <telerik:ChartPalette x:Key="customPalette">
            <telerik:ChartPalette.SeriesEntries>
                <telerik:PaletteEntryCollection SeriesFamily="Line">
                    <telerik:PaletteEntry Fill="Blue" Stroke="Blue"/>
                    <telerik:PaletteEntry Fill="Crimson" Stroke="Crimson"/>
                    <telerik:PaletteEntry Fill="Green" Stroke="Green"/>
                    <telerik:PaletteEntry Fill="DarkOrange" Stroke="DarkOrange"/>
                    <telerik:PaletteEntry Fill="Purple" Stroke="Purple"/>
                    <telerik:PaletteEntry Fill="DarkTurquoise" Stroke="DarkTurquoise"/>
                    <telerik:PaletteEntry Fill="SaddleBrown" Stroke="SaddleBrown"/>
                    <telerik:PaletteEntry Fill="SlateBlue" Stroke="SlateBlue"/>
                </telerik:PaletteEntryCollection>
            </telerik:ChartPalette.SeriesEntries>
        </telerik:ChartPalette>
 
        <local:StringToLegendSettingsConverter x:Key="StringToLegendSettingsConverter"/>
    </UserControl.Resources>
     
    <i:Interaction.Triggers>
        <!--OK notification dialog-->
        <prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest, Mode=OneWay}">
            <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
                <prism:PopupWindowAction.WindowContent>
                    <commonControls:NotificationDialogPopupView/>
                </prism:PopupWindowAction.WindowContent>
                <prism:PopupWindowAction.WindowStyle>
                    <Style TargetType="Window">
                        <Setter Property="ResizeMode" Value="NoResize"/>
                        <Setter Property="SizeToContent" Value="WidthAndHeight"/>
                    </Style>
                </prism:PopupWindowAction.WindowStyle>
            </prism:PopupWindowAction>
        </prism:InteractionRequestTrigger>
        . . . . . . . . . . . . . . . . . . . . . . . . . . .
    </i:Interaction.Triggers>
     
    <Grid>
     
        <!--Menu displayed when user clicks right mouse button-->
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu>
                <telerik:RadMenuItem Header="Show Bar Chart" IsCheckable="True" IsChecked="{Binding IsBarChartSelected, Mode=TwoWay}"
                                     Command="{Binding ShowBarChartCommand}"/>
                <telerik:RadMenuItem Header="Show Curve Splne Chart" IsCheckable="True" IsChecked="{Binding IsSplineChartSelected, Mode=TwoWay}"
                                     Command="{Binding ShowSplineChartCommand}"/>
                . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
            </telerik:RadContextMenu>
        </telerik:RadContextMenu.ContextMenu>
         
        <!--Bar chart of gas velocity value on each ultrasonic beam-->
        <telerik:RadCartesianChart Visibility="{Binding IsAbsoluteBarChartVisible}">
            <!--X axis-->
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis/>
            </telerik:RadCartesianChart.HorizontalAxis>
            <!--Y axis---->
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis Title="Метры в секунду [м/с]" Minimum="{Binding ChartMinimum}" Maximum="{Binding ChartMaximum}" MajorStep="{Binding CurrentStep}"/>
            </telerik:RadCartesianChart.VerticalAxis>
            <!--Bar chart itself-->
            <telerik:RadCartesianChart.Series>
                <telerik:BarSeries ShowLabels="True" CategoryBinding="Category" ValueBinding="Value" ItemsSource="{Binding Data}" />
            </telerik:RadCartesianChart.Series>
        </telerik:RadCartesianChart>
         
        <!--Visualizer of colors of all curves in the curve chart of gas velocity value on each ultrasonic beam-->
        <telerik:RadLegend Grid.Column="1" Items="{Binding LegendItems, ElementName=splineAbsoluteChart}" HorizontalAlignment="Right" VerticalAlignment="Top"
                           Visibility="{Binding IsAbsoluteSplineChartVisible}"/>
        <!--Curve spline chart of gas velocity value on each ultrasonic beam-->
        <telerik:RadCartesianChart x:Name="splineAbsoluteChart" Visibility="{Binding IsAbsoluteSplineChartVisible}" Palette="{StaticResource customPalette}">
            <!--Turn scrollbars off-->
            <telerik:RadCartesianChart.Resources>
                <Style TargetType="telerik:PanZoomBar">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </Style>
            </telerik:RadCartesianChart.Resources>
            <!--X axis-->
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeContinuousAxis MajorStepUnit="Second" LabelInterval="5" LabelFormat="hh:mm:ss" FontFamily="Segoe UI" PlotMode="OnTicks" TickOrigin="{Binding AlignmentDate}"/>
            </telerik:RadCartesianChart.HorizontalAxis>
            <!--Y axis-->
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis FontFamily="Segoe UI" Title="Метры в секунду [м/с]" />
            </telerik:RadCartesianChart.VerticalAxis>
            <!--Layout grid-->
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY" MajorXLineDashArray="3,4" MajorYLineDashArray="3,4"/>
            </telerik:RadCartesianChart.Grid>
            <!--Series provider of curves-->
            <telerik:RadCartesianChart.SeriesProvider>
                <telerik:ChartSeriesProvider Source="{Binding SeriesData}">
                    <telerik:ChartSeriesProvider.SeriesDescriptors>
                        <telerik:CategoricalSeriesDescriptor CategoryPath="Category" ValuePath="Value" ItemsSourcePath="ChartPoints">
                            <telerik:CategoricalSeriesDescriptor.TypeConverter>
                                <local:SeriesTypeConverter/>
                            </telerik:CategoricalSeriesDescriptor.TypeConverter>
                            <telerik:CategoricalSeriesDescriptor.Style>
                                <Style TargetType="telerik:SplineSeries" BasedOn="{StaticResource SplineSeriesStyle}">
                                    <Setter Property="LegendSettings" Value="{Binding  SeriesName, Converter={StaticResource StringToLegendSettingsConverter}}"/>
                                </Style>
                            </telerik:CategoricalSeriesDescriptor.Style>
                        </telerik:CategoricalSeriesDescriptor>
                    </telerik:ChartSeriesProvider.SeriesDescriptors>
                </telerik:ChartSeriesProvider>
            </telerik:RadCartesianChart.SeriesProvider>
            <!--Behaviors-->
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior DragMode="Pan" ZoomMode="Both"  PanMode="Both"/>
            </telerik:RadCartesianChart.Behaviors>
            <!--Mapping events handling to the ViewModel-->
            <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding ShowHistoricalChartCommand}" EventName="PreviewMouseDoubleClick" RaiseOnHandledEvents="True" PassEventArgsToCommand="True"/>
            </telerik:EventToCommandBehavior.EventBindings>
        </telerik:RadCartesianChart>
         
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
     
    </Grid>
</UserControl>

If you'd like you can see gas velocity bar chart in 'GasVelocityBarChart.PNG' file attached. And you can see gas velocity spline chart in 'GasVelocitySplineChart.PNG' file attached.

So, I'm very interested in the following thing: How to put the content (that is inside the <UserControl></UserControl> tag in the figure above) into <FrameworkElement.Resources></FrameworkElement.Resources> tag? After all, this inserted content itself has in its composition the <UserControl.Resources>...</UserControl.Resources> and <i:Interaction.Triggers>...</i:Interaction.Triggers> tags. Please help me understand this. I will be very grateful to you for your help because I really appreciate your help.

Dmitry
Top achievements
Rank 1
 answered on 13 Jun 2017
2 answers
737 views

I am using the Office 2013 Theme on my project and the arrow on the RadComboBox is very small.  Also, for some reason, you have to click directly on the arrow itself in order for the dropdown to open.  If you click anywhere in the ToggleButton area around the arrow it will not open.  So anywho, I decided to try changing the toggle button on the control to make it larger.  I basically got some code for a normal ComboBox from https://stackoverflow.com/questions/27128526/how-to-change-combobox-arrow-image-in-wpf and modified it to work with the telerik:RadComboBox.  The control shows as intended in the XAML design window but, when I run the application the styling does not take effect.  Any idea what I may be missing here? 

 

      xmlns:ExtendedGridControl="clr-namespace:ExtendedGrid.ExtendedGridControl;assembly=ExtendedGrid"
      xmlns:ExtendedColumn="clr-namespace:ExtendedGrid.ExtendedColumn;assembly=ExtendedGrid"
      x:Class="SuperGateWPFT.Page1"
      xmlns:rv="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"            
      xmlns:local="clr-namespace:SuperGateWPFT"
      mc:Ignorable="d"  d:DesignHeight="775" d:DesignWidth="1200"  MinWidth="1200" MinHeight="775"
      Title="SuperGate"  Loaded="Page_Loaded">
 
    <Page.Resources>

<DataTemplate x:Key="MultipleSelectionBoxTemplateDept">
            <TextBlock Text="{Binding ElementName=cmbDept, Path=SelectedItems.Count, StringFormat='Selected Items Count: {0}'}" Foreground="Red" FontWeight="Bold" />
        </DataTemplate>

 

        <!--Toggle Button Template-->
        <ControlTemplate x:Key="MyRadToggleButton" TargetType="telerik:RadToggleButton">
            <Grid x:Name="gd">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="25" />
                </Grid.ColumnDefinitions>
                <Border x:Name="Border" SnapsToDevicePixels="True" Grid.ColumnSpan="2" Background="White" BorderBrush="Black" BorderThickness="1"/>
                <Border x:Name="Boredr1" SnapsToDevicePixels="True" Grid.Column="1"  Margin="1" Background="Black" BorderBrush="Black" BorderThickness="0,0,1,0" />
                <Path x:Name="Arrow" SnapsToDevicePixels="True" Grid.Column="1" Fill="White" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 6 6 L 12 0 Z"/>
                <ContentPresenter Grid.Column="0" TextElement.Foreground="Orange"></ContentPresenter>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="telerik:RadToggleButton.IsMouseOver" Value="True">
                    <Setter TargetName="Border" Property="BorderBrush" Value="Black"/>
                    <Setter TargetName="Boredr1" Property="BorderBrush" Value="Black"/>
                </Trigger>
                <Trigger Property="telerik:RadToggleButton.IsChecked" Value="True">
                    <Setter TargetName="Arrow" Property="Data" Value="M 0 0 L 5 5 L 10 0"/>
                    <Setter TargetName="Arrow" Property="Fill" Value="White"/>
                    <Setter TargetName="Arrow" Property="Stroke" Value="White"/>
                    <Setter TargetName="Arrow" Property="StrokeThickness" Value="1.5"/>
                </Trigger>
                <Trigger Property="telerik:RadToggleButton.IsEnabled" Value="False">
                    <Setter TargetName="gd" Property="Visibility" Value="Visible"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
 
        <!--TextBox Template-->
        <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
            <ScrollViewer x:Name="PART_ContentHost" Focusable="False" />
        </ControlTemplate>
 
        <!--combobox-->
        <Style x:Key="MyComboBoxStyle" TargetType="telerik:RadComboBox">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate  TargetType="telerik:RadComboBox">
                        <Grid>
                            <telerik:RadToggleButton Name="ToggleButton" Foreground="Black" Template="{StaticResource MyRadToggleButton}" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press">
                            </telerik:RadToggleButton>
                            <ContentPresenter Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3,3,23,3"  VerticalAlignment="Center" HorizontalAlignment="Left" />
                            <TextBox OverridesDefaultStyle="True" SelectionBrush="Gray" CaretBrush="Black" Margin="0,0,30,0" TextWrapping="NoWrap"   x:Name="PART_EditableTextBox" FontFamily="Segoe UI Dark"   Foreground="Black" Style="{x:Null}" Template="{StaticResource ComboBoxTextBox}" HorizontalAlignment="Left" Focusable="True"  VerticalAlignment="Center"  FontSize="15"   Visibility="Hidden" IsReadOnly="{TemplateBinding IsReadOnly}"/>
                            <Popup Name="Popup"  Grid.ColumnSpan="2" Placement="Bottom"  IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
                                <Grid Name="DropDown" SnapsToDevicePixels="True" MaxWidth="{TemplateBinding ActualWidth}" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                    <Border Grid.ColumnSpan="2" Grid.RowSpan="2" x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="Transparent" MaxWidth="{TemplateBinding ActualWidth}" BorderThickness="1" BorderBrush="Black"/>
                                    <ScrollViewer Grid.ColumnSpan="2" ScrollViewer.CanContentScroll="False" Grid.Row="1" SnapsToDevicePixels="True">
                                        <StackPanel IsItemsHost="True" Background="Transparent">
                                        </StackPanel>
                                    </ScrollViewer>
                                </Grid>
                            </Popup>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEditable" Value="true">
                                <Setter Property="IsTabStop" Value="false"/>
                                <Setter  TargetName="PART_EditableTextBox" Property="Background" Value="White"/>
                                <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                                <Setter TargetName="PART_EditableTextBox" Property="Foreground" Value="Black"/>
                                <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="false">
                                <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="IsTabStop" Value="false"/>
                                <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                                <Setter TargetName="PART_EditableTextBox" Property="Foreground" Value="Black"/>
                                <Setter  TargetName="PART_EditableTextBox" Property="IsEnabled" Value="False"/>
                                <Setter  TargetName="PART_EditableTextBox" Property="Background" Value="White"/>
                                <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                            </Trigger>
                            <Trigger Property="IsGrouping" Value="true">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                            </Trigger>
                            <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                                <Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
            </Style.Triggers>
        </Style>
    </Page.Resources>
 
<Border BorderThickness="1" BorderBrush="Black" Height="27">
        <telerik:RadComboBox Style="{StaticResource MyComboBoxStyle}"  Name="cmbDept" AllowMultipleSelection="True" IsEditable="False" Width="250" Height="25" Margin="0,0,0,0" VerticalAlignment="Top" ItemsSource="{Binding}" MultipleSelectionBoxTemplate="{StaticResource MultipleSelectionBoxTemplateDept}" OpenDropDownOnFocus="True"></telerik:RadComboBox>
</Border>
Sia
Telerik team
 answered on 12 Jun 2017
3 answers
92 views

Hi,
Was wondering on how I can access the sort order of items in the list so I can save their order?

Polya
Telerik team
 answered on 09 Jun 2017
3 answers
194 views

I'm trying to bind my own ICommand to a RadRibbonButton's Command. My code is based on the example at http://demos.telerik.com/silverlight/#RichTextBox/Binding. The relevant bit of the XAML hierarchy is:

<telerik:RadRichTextBoxRibbonUI DataContext="{Binding Path=Commands, ElementName=richTextBox}">
     <telerik:RadRichTextBoxRibbonUI.QuickAccessToolBar>
                        <telerik:QuickAccessToolBar>
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}"     <== This is the button I want to bind my MVVM ICommand to.

Obviously, I removed the RichTextCommand attached property, and tried to bind the Command property to the ICommand on my viewmodel, which is set as the DataContext for the Window. As you can see, the example XAML (above) modifies DataContext at the RadRichTextBoxRibbonUI level, so to get back to "my" DataContext, I set a "Name" to an element higher up the visual tree, and used "ElementName" in my Binding, with the intent of using "Path=DataContext.MySaveCommand"; but I got a binding error saying that it couldn't even find the named element. I also tried {x:Reference} but got circular reference issues with that.

Please can someone demonstrate how to bind that command using MVVM?

My project references the "2016.3.1024.45" version of the assemblies. I tried attaching it; but it wouldn't let me.

Richard
Top achievements
Rank 1
 answered on 09 Jun 2017
1 answer
78 views

 

Hi,

Is there a way to show tool tip when I hovering on the "hour" or "day" in my time line? see attached file.

When I hovering 11 AM I want to show tool tip  : 11:00 AM Aug 6 2012

(according the boundaries of the start/end TimeLine parameters)
When I hovering 13 PM I want to show tool tip  : 13:00 PM Aug 6 2012

 

Martin Ivanov
Telerik team
 answered on 09 Jun 2017
1 answer
132 views

Hi,

 

I have a custom library which has provision to handle '+', '-' and many other operators along with custom functions. My requirement is that, I want spreadsheet to call my library to evaluate the cell formula. The operands of the operators ('+' etc. ) are custom and cannot be calculated by default engine.

Boby
Telerik team
 answered on 09 Jun 2017
1 answer
133 views
We're trying to upgrade our applcations to version 2017 R2 (from 2016 R2) and we are unable to get the dialog boxes from the radRichTextBox control to appear (font and paragraph). When we try to open those dialogs explicitly in code we get exceptions thrown. While tracking down the problems we found that you've introduced many compile time checks for WPF in your code (#if WPF) which are causing the problems.

The assumption in your code that checking for WPF at compile time is enough is incorrect in cases (like ours) that  have applications that mix both WinForms and WPF in the same application. The ability to mix is a core feature provided by Microsoft to provide the ability to support and enhance legacy WinForms applications with WPF functionality.

The error we're experiencing is in the method DialogHelper.CheckApplicationTheme. When the code attempts to access the Application object it is failing because we don't have a WPF Application object - we have a WInForms object. That results in the Application.Current value being null which causes an exception.

We've been using your WPF controls for years and haven't had this problem with previous versions and this is a major problem for us. Microsoft has supported mixing WPF, WInForms and even C++ in one application for years and we have used that ability extensively in our applications. Until now your controls have supported that functionality too.

Do you have a recommended method for supporting mixed application types like we have?
Would rebuilding your WPF source code with the WPF compile flag turned off help us or will there be side effects to that?
Martin
Telerik team
 answered on 09 Jun 2017
1 answer
139 views

Freeze Pane is not working as expected when we try to change freeze position programmatically.

When i try to change freeze position on a Button click the change in the UI for freeze is not happening.

 

Is anything i am doing wrong.?

Thanks

Deyan
Telerik team
 answered on 08 Jun 2017
1 answer
383 views

Hi

I have a RadCartesianChart (see XAML below) in a DataGridTemplateColumn but cannot find a way to reduce the amount of vertical space it is taking up.  It seems to have a minimum height?  Please advise.

<DataGridTemplateColumn Header="MyColumn"
IsReadOnly="True"
Width="300">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<telerik:RadCartesianChart Name="MyChart"
VerticalAlignment="Stretch"
Margin="10"
MaxHeight="20">
<telerik:RadCartesianChart.Behaviors>
<telerik:ChartTooltipBehavior />
</telerik:RadCartesianChart.Behaviors>
<telerik:LineSeries ItemsSource="{Binding HistoricValues}"
ValueBinding="RawValue"
CategoryBinding="Year">
<telerik:LineSeries.PointTemplate>
<DataTemplate>
<Ellipse Fill="Blue"
Width="8"
Height="8"/>
</DataTemplate>
</telerik:LineSeries.PointTemplate>
</telerik:LineSeries>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Minimum="{Binding HistoricValueMinimum}"
Maximum="{Binding HistoricValueMaximum}"
MajorStep="{Binding HistoricValueStep}"
Visibility="Collapsed"/>
</telerik:RadCartesianChart.VerticalAxis>
</telerik:RadCartesianChart>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

Thanks

 

Martin Ivanov
Telerik team
 answered on 08 Jun 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?