Telerik Forums
UI for WPF Forum
2 answers
214 views

Hi, 

I have these comboboxes that use a keyed style that defines the ClearSelectionButtonContent, the first combobox that is clicked looses its ClearSelectionButtonContent after clicking on another one. To try it out, create a new WPF app and paste the code below in the MainWindow.xaml file and experiment with it, you will see what I mean. It can even be seen in design mode. I'm using VS 2017 (15.2 2643.15) and telerik 2017.1.222.45. 

Thanks for looking into this issue.

<Window
    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:System="clr-namespace:System;assembly=mscorlib" xmlns:Chromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"
    x:Class="WpfApp2.MainWindow"
    Title="MainWindow" Height="150" Width="325">
    <Window.Resources>
        <Style x:Key="radcomboboxstyle" TargetType="{x:Type telerik:RadComboBox}">
            <Setter Property="ClearSelectionButtonVisibility" Value="Visible"/>
            <Setter Property="ClearSelectionButtonContent">
                <Setter.Value>
                    <Grid>
                        <Ellipse Height="20" Width="20" Fill="Red"/>
                        <TextBlock Text="X" TextElement.FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" />
                    </Grid>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Row="0">
            <Label Content="ComboBox1" VerticalAlignment="Center"/>
            <telerik:RadComboBox Width="150" Height="30" Style="{StaticResource radcomboboxstyle}" >
                <telerik:RadComboBoxItem Content="Item 1"/>
                <telerik:RadComboBoxItem Content="Item 2"/>
                <telerik:RadComboBoxItem Content="Item 3"/>
            </telerik:RadComboBox>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <Label Content="ComboBox2" VerticalAlignment="Center"/>
            <telerik:RadComboBox Width="150" Height="30" Style="{StaticResource radcomboboxstyle}" >
                <telerik:RadComboBoxItem Content="Item 1"/>
                <telerik:RadComboBoxItem Content="Item 2"/>
                <telerik:RadComboBoxItem Content="Item 3"/>
            </telerik:RadComboBox>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="2">
            <Label Content="ComboBox3" VerticalAlignment="Center"/>
            <telerik:RadComboBox Width="150" Height="30" >
                <!-- Setting the style explicitly instead of via a reference to the keyed style defined in the resources -->
                <telerik:RadComboBox.Style>
                    <Style TargetType="{x:Type telerik:RadComboBox}">
                        <Setter Property="ClearSelectionButtonVisibility" Value="Visible"/>
                        <Setter Property="ClearSelectionButtonContent">
                            <Setter.Value>
                                <Grid>
                                    <Ellipse Height="20" Width="20" Fill="Red"/>
                                    <TextBlock Text="X" TextElement.FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" />
                                </Grid>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </telerik:RadComboBox.Style>
                <telerik:RadComboBoxItem Content="Item 1"/>
                <telerik:RadComboBoxItem Content="Item 2"/>
                <telerik:RadComboBoxItem Content="Item 3"/>
            </telerik:RadComboBox>
        </StackPanel>
    </Grid>
</Window>

Michel Cossette
Top achievements
Rank 1
 answered on 17 Jul 2017
13 answers
524 views
Hi
I have a problem with the RadDocking pane which doesn't auto-hide after selecting an item in a list box contained within the RadPane. I want the user to be able to mouse-over the pane header to show the pane (in unpinned mode) and then click or double click an item in the list contained within the pane. When the user moves the mouse away or sets focus to another part of the application, the pane should auto-hide.
Currently if the user mouses over the pane header, the pane slides into view, and on mouse leave the pane auto-hides correctly. However, if they mouse over the header and then select an item in the list box on the pane, the pane then refuses to auto-hide, no matter what control gets focus after that. The only way to hide the pain is then to manually pin and unpin it.

How can I get the pane to auto-hide correctly?

XAML below:

<
telerik:RadDocking>
      <telerik:RadDocking.DocumentHost>
          <!--document here-->
      </telerik:RadDocking.DocumentHost>
           
      <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">
          <telerik:RadPaneGroup>                       
              <telerik:RadPane IsPinned="True" Header="Products" CanUserClose="False"
                              CanFloat="False"
                              CanDockInDocumentHost="False"
                              ContextMenuTemplate="{x:Null}">
                  <telerik:RadPane.HeaderTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding}" Margin="0, 0, 80, 0"/>
                      </DataTemplate>
                  </telerik:RadPane.HeaderTemplate>
                       
                  <!--Product List-->
                  <telerik:RadListBox>
                             <!--- databound to product list -->
                  </telerik:RadListBox>
              </telerik:RadPane>
          </telerik:RadPaneGroup>
      </telerik:RadSplitContainer>
  </telerik:RadDocking>

Thanks,
Guy
Kevin
Top achievements
Rank 1
 answered on 17 Jul 2017
2 answers
826 views

I am attempting to set a column's cell template in code to a template that is also generated in code, but its not working as I assumed it would.
The template seems to only be applied to one row at a time, always the last row to draw. I suspect this is because its an instance of a template and not a resource, but I'm not sure the right way to set this up.

I am making a custom search control that displays results in a grid; I need to add a button to a column and hook the click event up. It is much easier for me to set up in code in this case.

 

public override void OnApplyTemplate()
{
    base.OnApplyTemplate();

   //find grid column control part
    GridViewColumn PART_SelectColumn = GetTemplateChild("PART_SelectColumn") as Telerik.Windows.Controls.GridViewColumn;

    //make cell content
    RadButton btn_SelectItem = new RadButton() { Content = "Add"};
    btn_SelectItem .Click += PART_SelectItem_Click;

    //generate template - code builds a sealed datatemplate with the button as the content
    DataTemplate SelectTemplate = DataTemplateExtentions.CreateDataTemplate ( () => { return btn_SelectItem }  );

    //Set the column's cell template - I suspect this is what I'm doing wrong
    PART_SelectColumn.CellTemplate = SelectTemplate;

}

 

see attached image; the template only applies to the last row. 

Anyone know where I'm going wrong?

 

jen
Top achievements
Rank 1
 answered on 17 Jul 2017
4 answers
429 views

Hello

 

When I set DropDownPlacement = "Left", the MenuItem sometimes opens to the left, sometimes to the right.
If I set DropDownPlacement = "Right" the same game - the MenuItem opens sometimes left, sometimes right.

 

<telerik:RadMenu x:Name="topmenu" Grid.Row="0" Grid.ColumnSpan="4" IconColumnWidth="0" VerticalAlignment="Top" HorizontalAlignment="Stretch">
            <telerik:RadMenuItem Header="Allgemein" DropDownPlacement="Bottom">
                <telerik:RadMenuItem Header="Beenden" Command="{Binding ExitApplicationCommand}"/>
                <telerik:RadMenuItem Header="Info" Command="{Binding InfoCommand}"/>
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="Protokolle" Command="{Binding OpenChangeProtocolViewCommand}"/>
 
            <telerik:RadMenuItem DataContext="{Binding MenuDocuments}" ItemsSource="{Binding ChildMenuItems, UpdateSourceTrigger=PropertyChanged}"
                                 Header="{Binding Header, UpdateSourceTrigger=PropertyChanged}" StaysOpenOnClick="True"
                                 DropDownPlacement="Left">
                <telerik:RadMenuItem.Resources>
                    <HierarchicalDataTemplate DataType="{x:Type local:MenuItemViewModel}" ItemsSource="{Binding ChildMenuItems, UpdateSourceTrigger=PropertyChanged}">
                        <telerik:RadMenuItem Header="{Binding Header, UpdateSourceTrigger=PropertyChanged}"
                                             Command="{Binding ExecuteCommand}" StaysOpenOnClick="True"
                                             DropDownPlacement="Left">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseEnter" >
                                    <i:InvokeCommandAction Command="{Binding MouseEnterCommand}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </telerik:RadMenuItem>
                    </HierarchicalDataTemplate>
                </telerik:RadMenuItem.Resources>
            </telerik:RadMenuItem>
        </telerik:RadMenu>

 

We would like, that all menuitem always open on the left site from parent menu.

Is this possible with the RadMenu Control?

For what purpose is the setting DropDownPlacement?

 

Thank you

Birgit
Top achievements
Rank 1
 answered on 17 Jul 2017
1 answer
318 views

Hello.

 

I have a column in my RadGridView that's bound to a DateTime field of my data source. It's showing both date and time (i.e. 7/7/2017 2:22 PM). When I'm clicking the Filter button (next to the column name) I'm getting the filtering popup with the distinct values and two Date pickers. Is there a way to make them DateTime pickers instead?

 

I tried to use AutoGenerateColumns="True" so that my customizations don't interfere but I'm still getting Date pickers.

Thank you.

Dilyan Traykov
Telerik team
 answered on 17 Jul 2017
9 answers
681 views

I use ExportToXlsx to export gridview data to an excel file using the following code snippet

 

gridView.ExportToXlsx(fs, new GridViewDocumentExportOptions()
{
    ShowColumnHeaders = true,
    AutoFitColumnsWidth = true
});

 

 Sometimes when opening the file in Excel I get the error message:

 

     Excel found unreadable content in ... Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

 

I can open the file after clicking yes, but the content is not in sync with the information as shown in the GridView.

It seems that this happens when the grid has empty cells e.g. we have a date field which can be omitted (null).

If I use the exportToPdf method al goes well using the same date in the gridview. So it seems it's an issue related to Excel export.

Is this a bug or otherwise how can I fix this issue? 

I use version 2015.1.401.45

 

Regards,
Peter

 

Yana
Telerik team
 answered on 17 Jul 2017
7 answers
411 views
How can I disable sorting on Group Header?

I want this sorting feature should be enabled only on Columns.
Once If I drag any of the column and in Grouped headers I dont want this sorting option.
Boyan Dimitrov
Telerik team
 answered on 17 Jul 2017
7 answers
1.5K+ views

I'm just starting out with WPF and with the Telerik controls and am trying to work with RadWindow; I'm following the example in "User RadWinfow as UserControl" and the window is running but it is not displaying on the screen. I've followed the example to the letter so stuck as to what the issue is?

The RadWindow XAML is as per the example:

<telerik:RadWindow x:Class="Temp.TelerikScenario1"
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"
Header="TelerikScenario1" Height="300" Width="300">
<Grid>
</Grid>
</telerik:RadWindow>

and so is the code:

public partial class TelerikScenario1
{
public TelerikScenario1()
{
InitializeComponent();
}
}

Then I try to open in the MainWindow.xaml.cs:

 

public MainWindow()
{
InitializeComponent();
TelerikScenario1 window = new TelerikScenario1();
window.Show();
}

And whilst I can see the code is running for the TelerikScenario1 RadWindow it is not displayed on the screen? (if I declare a new Radwindow in c#  "RadWindow radWindow = new RadWindow();" then that opens fine).

 

Kalin
Telerik team
 answered on 17 Jul 2017
6 answers
306 views
Hi,

I have 2 RadGridView's in a window both of which perform row level validation.  I am able to raise an exception" "An infinite loop appears to have resulted from cross-dependent views." when both grids are validating. 

Ive created a very basic test app and here are the steps:
  1. Top Grid.  Click "Click here to add a new item" to add a new row.
  2. Bottom Grid do the same.

     

    The Top grid will show the row as invalid. and the botton grid will have a new row
  3. Click in the bottom grid's new row (the Initial value 2 column) and it will crash

Here is the Xaml

<Window x:Class="TestMultipleRadGrids.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
         
        <telerik:RadGridView Grid.Row="0"
                             x:Name="_rad1"
                             ValidatesOnDataErrors="InEditMode"
                             ShowGroupPanel="False" 
                             AutoGenerateColumns="False"
                             CanUserReorderColumns="True"
                             CanUserInsertRows="True"
                             RowValidating="_rad1_RowValidating"
                             ShowInsertRow="True">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name1" />
                <telerik:GridViewDataColumn Header="Initial Value1" DataMemberBinding="{Binding InitialValue1, Mode=TwoWay}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 
        <telerik:RadGridView Grid.Row="1"
                             x:Name="_rad2"
                             ShowGroupPanel="False" 
                             ValidatesOnDataErrors="InEditMode"
                             AutoGenerateColumns="False"
                             CanUserReorderColumns="True"
                             CanUserInsertRows="true"
                             RowValidating="_rad2_RowValidating"
                             ShowInsertRow="True">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name2"/>
                <telerik:GridViewDataColumn Header="Initial Value2" DataMemberBinding="{Binding InitialValue2, Mode=TwoWay}" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>


Here is the code behind:

using System.Windows;
using Telerik.Windows.Controls;
 
namespace TestMultipleRadGrids
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
 
        private void _rad1_RowValidating(object sender, Telerik.Windows.Controls.GridViewRowValidatingEventArgs e)
        {
            GridViewCellValidationResult validationResult = new GridViewCellValidationResult();
            validationResult.PropertyName = "InitialValue1";
            validationResult.ErrorMessage = "Error";
            e.ValidationResults.Add(validationResult);
            e.IsValid = false;
        }
 
        private void _rad2_RowValidating(object sender, Telerik.Windows.Controls.GridViewRowValidatingEventArgs e)
        {
            _rad1.Focus();
 
            GridViewCellValidationResult validationResult = new GridViewCellValidationResult();
            validationResult.PropertyName = "InitialValue2";
            validationResult.ErrorMessage = "Error";
            e.ValidationResults.Add(validationResult);
            e.IsValid = false;
        }
    }
}


Any help would be greatly appreciated.

Martin Ivanov
Telerik team
 answered on 17 Jul 2017
1 answer
130 views
We were looking at implementing KPI support in the WPFpivotGrid.  Is this only available when using an OLAP data source?
Polya
Telerik team
 answered on 14 Jul 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?