Telerik Forums
UI for WPF Forum
2 answers
756 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
96 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
200 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
81 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
137 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
142 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
149 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
408 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
5 answers
126 views

Hello everyone.

I have noticed a strange RadGridView's behavior when I'm copying value from decimal cell (with DataFormat string) or exporting grid content to Excel. 

If I use IQueryable as GridView ItemsSource, there is copied value the same as on-screen value. For example, I have a value 1000000 in data source and {0:N2} as DataFormatString, and a result value displayed in cell will be "1 000 000,00". When I copy this cell via Ctrl+C or export the datagrid to Excel, the result will be also "1 000 000,00", string with spaces between digits, not number. Math functions in Excel cannot be applied for that value.

However, If use IEnumberable instead IQueryable, the exported and pasted values will be absolutely the same as it in DataSource and will have their native type (decimal).

How can I copy the cell value in it native type using IQueryable as data source?

Ivan Ivanov
Telerik team
 answered on 08 Jun 2017
2 answers
172 views
I would like to implement a ComboBox font selector for all selected diagram text elements. I currently can achieve this via a one-way binding (i.e., the user selects the items, then changes the value of the ComboBox which applies the font to each element). How can I achieve two-way binding for this?
Josh
Top achievements
Rank 1
 answered on 08 Jun 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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?