Telerik Forums
UI for WPF Forum
6 answers
1.1K+ views

I've had a standard ComboBox working with this code:

 

<ComboBox
    x:Name="comboWindow1"
    SelectedValue="{Binding Window1Page}"
    ItemsSource="{Binding listDashData, UpdateSourceTrigger=PropertyChanged}"
    DisplayMemberPath="ddDashDescription"
    SelectedValuePath="ddDashName"
    SelectionChanged="comboWindow1_SelectionChanged">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="{x:Type ComboBoxItem}">
            <Setter Property="IsEnabled" Value="{Binding ddDashEnabled}"/>
        </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>

I switched over to the RadComboBox, thinking I could do almost exactly the same thing. However when I select the drop down, I get no items. If I remove the ContainerStyle then that works a treat.

I've looked at the various examples in the help, but nothing seems to work.

Both these code examples fail:

<UserControl.Resources>
    <Style x:Key="ComboIsEnabledStyle" TargetType="{x:Type tel:RadComboBoxItem}">
        <Setter Property="IsEnabled" Value="{Binding ddDashEnabled}"/>
    </Style>
</UserControl.Resources>
 
<tel:RadComboBox
    x:Name="comboWindow2"
    SelectedValue="{Binding Window2Page}"
    ItemsSource="{Binding listDashData, UpdateSourceTrigger=PropertyChanged}"
    DisplayMemberPath="ddDashDescription"
    SelectedValuePath="ddDashName"
    ItemContainerStyle="{StaticResource ComboIsEnabledStyle}"
    SelectionChanged="comboWindow2_SelectionChanged">      
</tel:RadComboBox>
 
<tel:RadComboBox
    x:Name="comboWindow1"
    SelectedValue="{Binding Window1Page}"
    ItemsSource="{Binding listDashData, UpdateSourceTrigger=PropertyChanged}"
    DisplayMemberPath="ddDashDescription"
    SelectedValuePath="ddDashName"
    SelectionChanged="comboWindow1_SelectionChanged">
    <tel:RadComboBox.ItemContainerStyle>
        <Style TargetType="{x:Type tel:RadComboBoxItem}">
            <Setter Property="IsEnabled" Value="{Binding ddDashEnabled}"/>
        </Style>
    </tel:RadComboBox.ItemContainerStyle>
</tel:RadComboBox>

I amended one of the Telerik ComboBox examples to demonstrate as that does exactly the same thing. Can't attach, so it's available here: ComboBoxCustomFilteringDemo.zip

I'm really stumped as to what I've missed, as this should really be such a simple thing to do.

BTW I'm running the latest 2015.1.225 WPF version

Nasko
Telerik team
 answered on 06 Mar 2017
3 answers
709 views

We have an application in which we would like to support a custom clipboard format for copying\pasting in a RadRichTextBox. I have read your article on clipboard support (http://docs.telerik.com/devtools/wpf/controls/radrichtextbox/features/clipboard-support), but that seems to mainly deal with changing which provided clipboard formats are used.

It appears that if I register a custom format provider with ClipboardEx, that would be able to handle pasting the custom format. For example:

ClipboardEx.ClipboardHandlers.Insert(0, new ClipboardHandler()
{
    ClipboardDataFormat = "MyCustomDataFormat",
    DocumentFormatProvider = new MyCustomFormatProvider()
});

 

However, I don't see a way to handle copying a custom format without intercepting the CopyExecutingCommand and adding the custom format the the clipboard. For example:

void RadRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e)
{
    if (e.Command is CopyCommand)
    {
        Clipboard.SetData("MyCustomDataFormat", GetSelectionAsCustomDataFormatString());
    }
}

However, I would want to make sure that the default clipboard formats are still added to the clipboard in addition to our custom format.

Can you provide any guidance on the best way to handle copying and pasting a custom clipboard format?

Thank you.

Boby
Telerik team
 answered on 06 Mar 2017
0 answers
87 views

In addition to the class provided by the class, I ask if there are any classes or methods that can be applied to a class that has style gridview

ex) no applied style gridview export option source, I want to applied style gridview export option

 public bool SaveDocument_GridViewUse(RadGridView gridViewList, ExcelExportTypeFDC selectedFormat)
        {
            try
            {
                string fileName;
                string appFileName = "";
                using (Stream stream = CreateFile(out fileName, selectedFormat))
                {
                        gridViewList.Export(stream, new GridViewExportOptions() {
                        Format = ExportFormat.Csv,
                        ShowColumnHeaders = true,
                    });
                }

                if (selectedFormat == ExcelExportTypeFDC.Xlsx) appFileName = "excel.exe";
                else if (selectedFormat == ExcelExportTypeFDC.Csv) appFileName = "excel.exe";
                else if (selectedFormat == ExcelExportTypeFDC.Txt) appFileName = "notepad.exe";

                ProcessStartInfo pInfo = new ProcessStartInfo(appFileName, fileName);
                pInfo.WindowStyle = ProcessWindowStyle.Maximized;
                Process.Start(pInfo);
            }

Top achievements
Rank 1
 asked on 05 Mar 2017
1 answer
174 views

The following is the code snippet from my code.  I have the command CheckTypeCommand defined in my Model. There are over 100,000 items in my collection and the number of columns is 50 odd. If I scroll up or down of this grid the command of this check box for every row that is render is getting executed. I want the command only to execute on UI trigger that is when I change the Check Type in the combobox. Can you please let me know what is I am missing here. If I disable Virtualization then the performance goes for a spin.

  <telerik:RadGridView x:Name="radGridView"  ItemsSource="{Binding myList}"  AutoGenerateColumns="False"
                             Grid.Row="3" Grid.ColumnSpan="2" FontSize="11"
                             SelectionMode="Single"  SelectionUnit="Mixed"
                             ClipboardCopyMode="Default"
                                 ActionOnLostFocus="CommitEdit" ScrollMode="RealTime" ElementExporting="radGridView_ElementExporting"
                                 SelectedItem="{Binding  Data.GridSelectedRow, Source={StaticResource proxy} , Mode=TwoWay}"  IsSynchronizedWithCurrentItem="False"
                                 ShowColumnSortIndexes="True" RowIndicatorVisibility="Collapsed" behaviours:ContextMenuBehavior.ContextMenu="{Binding ElementName=GridContextMenu}" FrozenColumnCount="3" >
                                  
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="GridContextMenu" ItemsSource="{Binding ContextMenu}" ItemContainerStyle="{StaticResource MenuItemContainer}"  >
                    </telerik:RadContextMenu>
                 <telerik:GridViewDataColumn x:Name="checktypecombo" DataMemberBinding="{Binding CheckType, Mode=TwoWay}" 
                                UniqueName="CheckType" IsReadOnlyBinding="{Binding IsReadOnly}"    IsReadOnly="True"
                                                SortMemberPath="CheckType"   EditTriggers="CellClick"   IsFilterable="False" IsGroupable="False"
                                                IsSortable="False" Width="75">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Check Type" TextWrapping="Wrap" Style="{StaticResource TextBlockWhite}" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox Command="{Binding CheckTypeChanged}" 
                                                    SelectedValue="{Binding CheckType, Mode=OneWay}" SelectedValuePath="Tag"
                                                     IsEditable="False">
                                    <telerik:RadComboBoxItem Tag="C1" Content="Checktype1"/>
                                    <telerik:RadComboBoxItem Tag="C2" Content="C2"/>                    
                                </telerik:RadComboBox>
                                   </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewDataColumn>   
                         
</telerik:RadGridView

  <telerik:RadGridView x:Name="radGridView"  ItemsSource="{Binding myList}"  AutoGenerateColumns="False"
                             Grid.Row="3" Grid.ColumnSpan="2" FontSize="11" EnableColumnVirtualization="False" 
                             SelectionMode="Single"  SelectionUnit="Mixed"
                             ClipboardCopyMode="Default" 
                                 ActionOnLostFocus="CommitEdit" ScrollMode="RealTime" ElementExporting="radGridView_ElementExporting" 
                                 SelectedItem="{Binding  Data.GridSelectedRow, Source={StaticResource proxy} , Mode=TwoWay}"  IsSynchronizedWithCurrentItem="False"
                                 ShowColumnSortIndexes="True" RowIndicatorVisibility="Collapsed" behaviours:ContextMenuBehavior.ContextMenu="{Binding ElementName=GridContextMenu}" FrozenColumnCount="3" >
 
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="GridContextMenu" ItemsSource="{Binding ContextMenu}" ItemContainerStyle="{StaticResource MenuItemContainer}"  >
                    </telerik:RadContextMenu>
    <telerik:GridViewDataColumn x:Name="checktypecombo" DataMemberBinding="{Binding CheckType, Mode=TwoWay}"  
UniqueName="CheckType" IsReadOnlyBinding="{Binding IsReadOnly}"    IsReadOnly="True" 
                                                SortMemberPath="CheckType"   EditTriggers="CellClick"   IsFilterable="False" IsGroupable="False"
                                                IsSortable="False" Width="75">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Check Type" TextWrapping="Wrap" Style="{StaticResource TextBlockWhite}" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox Command="{Binding CheckTypeChanged}"  
                                                    SelectedValue="{Binding CheckType, Mode=OneWay}" SelectedValuePath="Tag" 
                                                     IsEditable="False">
                                    <telerik:RadComboBoxItem Tag="C1" Content="Checktype1"/>
                                    <telerik:RadComboBoxItem Tag="C2" Content="C2"/>  
</telerik:RadComboBox>
      </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewDataColumn>  

</telerik:RadGridView

Bernard
Top achievements
Rank 1
 answered on 03 Mar 2017
5 answers
495 views
Hi,

I am actually using a RadAutoCompleteBox, which is linked to an ObservableCollection of contacts (from entity).
But on run, when a contact  is selected, the property (DisplayMemberPath) does not display.

Here's my xaml code;

<telerik:RadAutoCompleteBox x:Name="lstReceiver"  <br> 
                           Margin="0" Grid.Column="1"  Height="25"<
br
                           ItemsSource="{Binding RecipientList, Mode=TwoWay}"<
br>
                           DisplayMemberPath="EmailAddress" SelectionMode="Multiple"<
br
                           SelectedItem="{Binding SelectedRecipient, Mode=TwoWay}"<
br>
                           TextSearchMode="StartsWith"<
br
                           SearchText="{Binding ContactSearchKeyWords, Mode=TwoWay, BindsDirectlyToSource=True}"<
br
                           TextSearchPath="EmailAddress">

And here's what is being displayed in Run Mode (View attached image).
Am I missing something here?

Dilyan Traykov
Telerik team
 answered on 03 Mar 2017
0 answers
144 views

Hi!
It is seems that gridview doesn't separate null value and enum's first value while filtering or sorting.

Example: 

MainWindow.xaml.cs : https://codeshare.io/aJb3dK

MainWindow.xaml:  https://codeshare.io/5Odrk0

Try to filter column by choosing Item 1.
dmitriy
Top achievements
Rank 1
 asked on 03 Mar 2017
1 answer
74 views

Hello everyone,

is it possible to disable the search criteria modifiers like +,- and " so that those characters are treated like any other? We have a grid that contains some records that start with a minus (e.g. -test, -1234), however when users start typing "-123" no results are returned. 

 

Dilyan Traykov
Telerik team
 answered on 03 Mar 2017
6 answers
254 views
Hi, I'm trying to get the following working:

I have a ViewModel which loads a list in a list.xaml. If something is clicked in the list.xaml a detail.xaml is opened

Now in this detail.xaml I have first a grid with some information about the clicked list item (description etc.) and below I want to show a RadDiagram with shapes.

To achieve this I have a property in my ViewModel which creates a object GraphSource of ObservableGraphSourceBase and returns it.

For simplicity the object just have a constructor with the following code:

1.Public Sub New()
2.    Dim warenEingang = New NodeViewModelBase With {.Content = "Wareneingang", .Position = New Point(40, 40)}
3.    Dim waschhaus = New NodeViewModelBase With {.Content = "Waschhaus", .Position = New Point(40, 80)}
4.    Dim warenAusgang = New NodeViewModelBase With {.Content = "Warenausgang", .Position = New Point(40, 120)}
5.    MyBase.AddNode(warenEingang)
6.    MyBase.AddNode(waschhaus)
7.    MyBase.AddNode(warenAusgang)
8.End Sub

 

In the ViewModel the property looks like this:

1.Public ReadOnly Property myGraphProperty()
2.    Get
3.        Dim graphSource = New GraphSource()
4.        Return graphSource
5.    End Get
6.End Property

 

Now on my detail.xaml the stuff for my RadDiagram is loaded from an external xaml, let's call it "raddiagram.xaml"

1.<!-- detail.xaml-->
2.<UserControl x:Class="detail" [...]>
3.    <!-- grid implementation -->
4.    <local:raddiagram.xaml />
5.</UserControl>

 

Finally I'min the raddiagram.xaml :-)

01.<UserControl x:Class="raddiagram"
06.    xmlns:local="clr-namespace:Views"
07.    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
09.    mc:Ignorable="d"
10.    d:DesignHeight="800" d:DesignWidth="800">
11.<Grid x:Name="LayoutRoot">
12.   <telerik:RadDiagram x:Name="diagram" GraphSource="{Binding myGraphProperty}" />
13. 
14.   <telerik:RadTreeView x:Name="tree" Grid.Column="1" Width="300" ItemsSource="{Binding Items}">
15.        <telerik:RadTreeView.ItemTemplate>
16.           <DataTemplate>
17.                <TextBlock Text="{Binding Content}" />
18.           </DataTemplate>
19.       </telerik:RadTreeView.ItemTemplate>
20.   </telerik:RadTreeView>
21.</Grid>
22.</UserControl>

 

With this example xaml - taken from the documentation --> two-way-mvvm , my shapes are shown (still the content needs a toString, but this is not the big problem here).
Unfortunately all shapes are laying at position (0,0) - but when trying to achieve anything written in with styles / templates nothing is shown anymore.

Question: How can I achieve, via a property access of a ViewModel, that I can "iterate" in my xaml over all shapes to style them (setter property position etc.).
The goal is (later) after the three shapes are shown correctly (as you can see above, the x-position is the same, but y- is increasing) to insert connections between them.

I tried this: http://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/mvvm-style-selectors but then nothing (shapes) is shown anymore on the RadDiagram.

Thanks for any hints/help

Timon

Dinko | Tech Support Engineer
Telerik team
 answered on 03 Mar 2017
2 answers
401 views

Hello, 

I have been trying to figure out how I can set the Label on a Categorical Axis to pull from my data object.  After hours of searching I was not able to find any examples or answers to this.

I have a set of objects which I am binding to for the series and plot points.  

public class UiDynamicChartSeries
{
    public string Name { get; set; }
    public List<UiDynamicChartPlot> ChartPlots { get; set; }
}
public class UiDynamicChartPlot
{
    public string PlotHeader { get; set; }
    public string CategoryHeader { get; set; }
    public object CategoryAxisLabel { get; set; }
    public string ValueFormat { get; set; }
    public object PlotCategory { get; set; }
    public object PlotValue { get; set; }
}

In the XAML, the PlotCategory binds the category values on the chart, whereas the PlotValue binds the values on the chart.

Here is the XAML in which I am binding (note: I did not include all of the various resources since those already work)

<telerik:RadCartesianChart x:Name="DynamicChartView" Grid.Row="1" Grid.Column="0"
                           Palette="{StaticResource ChartPalette}"
                           VerticalZoomRangeEnd="{Binding ChartVerticalZoomRangeEnd}"
                           VerticalZoomRangeStart="0">
    <telerik:RadCartesianChart.Style>
        <Style TargetType="{x:Type telerik:RadCartesianChart}">
            <Setter Property="TrackBallLineStyle" Value="{StaticResource TrackBallLineChartView}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding ShowTrackInfo}" Value="false">
                    <Setter Property="TrackBallLineStyle" Value="{x:Null}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </telerik:RadCartesianChart.Style>
    <telerik:RadCartesianChart.TrackBallInfoStyle>
        <Style TargetType="{x:Type telerik:TrackBallInfoControl}">
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock FontSize="14" Foreground="{StaticResource DarkSteelBlueBrush}" Style="{StaticResource TextBlockLabelCentered}" Text="{Binding}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </telerik:RadCartesianChart.TrackBallInfoStyle>
    <telerik:RadCartesianChart.Behaviors>
        <telerik:ChartPanAndZoomBehavior DragMode="Pan" MouseWheelMode="PanHorizontally" ZoomMode="Both" />
        <telerikChartView:ChartTrackBallBehavior ShowIntersectionPoints="{Binding ShowIntersectionPoints}" ShowTrackInfo="{Binding ShowTrackInfo}" SnapMode="ClosestPoint" TrackInfoUpdated="ChartTrackBallBehaviorOnTrackInfoUpdated" />
    </telerik:RadCartesianChart.Behaviors>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis Title="{Binding LineChartDynamicDataSets.CategoryTitle}" LabelFitMode="Rotate" LabelRotationAngle="-65" SmartLabelsMode="SmartStep" TitleTemplate="{StaticResource DataTemplateChartTitle}">
            <telerik:CategoricalAxis.LabelTemplate>
                <DataTemplate>
                 
                    <!-- This gives me the Date on the Event, what I want to do -->
                    <TextBlock Text="{Binding DataPoint.DataItem.CategoryAxisLabel}" />
                     
                    <!-- This gives me the Event Number, not desired -->
                    <TextBlock Text="{Binding}" />
                     
                </DataTemplate>
            </telerik:CategoricalAxis.LabelTemplate>
        </telerik:CategoricalAxis>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis Title="{Binding LineChartDynamicDataSets.ValueTitle}" MajorStep=".25" SmartLabelsMode="SmartStep" TitleTemplate="{StaticResource DataTemplateChartTitle}" />
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.Grid>
        <telerik:CartesianChartGrid MajorLinesVisibility="XY" />
    </telerik:RadCartesianChart.Grid>
    <telerik:RadCartesianChart.SeriesProvider>
        <telerik:ChartSeriesProvider Source="{Binding ChartData}">
            <telerik:ChartSeriesProvider.SeriesDescriptors>
                <telerik:CategoricalSeriesDescriptor CategoryPath="PlotCategory" ItemsSourcePath="ChartPlots" ValuePath="PlotValue">
                    <telerik:CategoricalSeriesDescriptor.Style>
                        <Style TargetType="{x:Type telerikChartView:LineSeries}">
                            <Setter Property="LegendSettings" Value="{Binding Name, Converter={StaticResource StringToChartLegendSettingsConverter}}" />
                            <Setter Property="TrackBallInfoTemplate" Value="{StaticResource TrackBallInfoTemplate}" />
                            <Setter Property="TrackBallTemplate" Value="{StaticResource TrackBallTemplate}" />
                        </Style>
                    </telerik:CategoricalSeriesDescriptor.Style>
                </telerik:CategoricalSeriesDescriptor>
            </telerik:ChartSeriesProvider.SeriesDescriptors>
        </telerik:ChartSeriesProvider>
    </telerik:RadCartesianChart.SeriesProvider>
</telerik:RadCartesianChart>

However, instead of the PlotCategory being used for the labels, I want the CategoryAxisLabel to be used instead.  The reasoning I need to do this is that in my data I have multiple events which happen on the same date.  When I originally plotted the chart all of the data points were plotted on the same day.  For a line chart that looked horrible.  So to change this I now plot to the events which gives me the lines desired, but now I want to display the date for the label and not the event number.  I have not been able to find a way to do this, and it is the last hurdle I need to overcome.

Thank you

Barry
Top achievements
Rank 1
 answered on 02 Mar 2017
0 answers
64 views
Hi, by default, if the value of a raddatetimepicker is null, and you try to change it, the month displayed is DateTime.now, is there a way to set it to maybe 3 months from today? 
band
Top achievements
Rank 1
 asked on 02 Mar 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?