Telerik Forums
UI for WPF Forum
0 answers
96 views

Hi,

 

I am using RadScheduleView for WPF. While trying to schedule appointments in the appointment dialog, I would like to get the date displayed as  12 Apr 2020 in date picker . However after setting Display format as Long, it gets displayed as 12 April 2010. I require month to be displayed in 3 letter format and should work in every region. Please suggest. If I set custom format, will it work correct depending on the region.?

 

Thanks,

Divya

Divya
Top achievements
Rank 1
 asked on 29 Apr 2020
4 answers
947 views

Hi to all,

I configured a Listbox with single Group, but if I change a GroupStyle, Group item not longer appears.

my XAML/C# code is this, and I attached a screenshots (where I put a red rectangle, it not shows my value), where I wrong?

01.FastSearchItems = new ObservableCollection<FastSearchItem>();
02.var view = new CollectionViewSource();
03.view.GroupDescriptions.Add(new PropertyGroupDescription(propertyName: "Tipo"));
04.view.Source = FastSearchItems;
05.FastSearchItemsFound = view;
06. 
07.//Add several items
08.FastSearchItems.Add(new FastSearchItem(/*parameter values*/));
09.//[..]
01.<telerik:RadListBox x:Name="FastSearchRadListBox" ItemsSource="{Binding FastSearchItemsFound.View}"
02.                    Grid.Row="2" Width="300" Grid.Column="2"
03.                    MouseDoubleClick="FastSearchRadListBox_MouseDoubleClick"
04.                    VerticalAlignment="Top"
05.                    Height="400" Visibility="{Binding FastSearchIsDropDownOpen,Converter={StaticResource VisibilityConverter}}"
06.                    ScrollViewer.VerticalScrollBarVisibility="Auto"
07.                    ScrollViewer.HorizontalScrollBarVisibility="Disabled">
08.    <telerik:RadListBox.ItemsPanel>
09.        <ItemsPanelTemplate>
10.            <StackPanel Orientation="Vertical" />
11.        </ItemsPanelTemplate>
12.    </telerik:RadListBox.ItemsPanel>
13.    <telerik:RadListBox.ItemTemplate>
14.        <DataTemplate>
15.            <StackPanel>
16.                <TextBlock Text="{Binding Caption}" />
17.            </StackPanel>
18.        </DataTemplate>
19.    </telerik:RadListBox.ItemTemplate>
20.    <telerik:RadListBox.GroupStyle>
21.        <GroupStyle>
22.            <GroupStyle.HeaderTemplate>
23.                <DataTemplate>
24.                    <StackPanel Orientation="Vertical" Background="#FAFAFA">
25.                        <TextBlock Text="{Binding Caption}" FontWeight="Bold"/>
26.                    </StackPanel>
27.                </DataTemplate>
28.            </GroupStyle.HeaderTemplate>
29.        </GroupStyle>
30.    </telerik:RadListBox.GroupStyle>
31.</telerik:RadListBox>
Nicholas
Top achievements
Rank 1
 answered on 29 Apr 2020
1 answer
249 views

Hi, good morning

I'm trying to change the theme to a RadOpenFileDialog, but I can't do it,

I've used these directions:

 Telerik.WinControls.UI.RadOpenFileDialog opfDialog = new Telerik.WinControls.UI.RadOpenFileDialog();
 opfDialog.OpenFileDialogForm.StartPosition = FormStartPosition.CenterScreen;
 opfDialog.OpenFileDialogForm.ThemeName = "Fluent";

StartPosition if it works, but ThemeName doesn't.

Could you help me?

 

Nadya | Tech Support Engineer
Telerik team
 answered on 29 Apr 2020
7 answers
547 views

Hi

currently i'm trying to integrate Intellisense support to rad richtextbox. i was able to display word list when press Ctrl+Space. but could not replace the word. is there any one who try such a thing. i have attached a screen shot which was develop using visual studio richtextbox. can not use that code for RadRichTextBox.

Dimitar
Telerik team
 answered on 29 Apr 2020
9 answers
387 views

Hi I need to scale an image so that it fills all the empty space in a page. For this I am trying to find the remaining height of the page after some elements are inserted in it. I am using the following code:

var position = new DocumentPosition(section.GetRootDocument());
position.MoveToDocumentEnd();
var pageContentHeight = section.PageSize.Height - position.Location.Y - section.PageMargin.Vertical;

 

The problem is that position.Location.Y does't return a value in pixels. For example when my page is filed with text it returns 173.8107 but the height of the page is 1056. 

How to get position of last element in RadDocument in pixels?

Remus
Top achievements
Rank 1
Veteran
 answered on 29 Apr 2020
2 answers
192 views

I have a CartesianCustomAnnotation on my chart that  draws an ellipse.  The ellipse must cover the same amount of chart coordinates (millimeters) in X and Y.  Since ellipse height and width are pixels, I had to bind them with a MultiConverter that uses the chart's ConvertDataToPoint function to convert to pixels   It generally works well.

But if I change Vertical/Horizontal axes Minimum/Maximum values in code-behind (to achieve Equal-Scale effect I asked you about), even though my binding gets invoked and calls ConvertDataToPoint agin, the pixel values returned do NOT reflect the chart new layout.  I'll get values representing the old axis min/max values and they'll look terrible with the new scaling

But then, if I do anything at all to force another update of the binding, suddenly, the values returned will look great again.  Even if the change does not alter the underlying values in any meaningful way.

It's almost as the chart's layout code needs for a UI update happen on the control before ConvertDataToPoint will start returning numbers appropriate to the new axes min/max values.

Is there any truth to do this?  If I change an axis max/min, do I need to do something (force some layout/update or something) before calling ConvertDataToPoint?    Or is there some chart/axis property I should be binding to instead of what I'm using (see below)

Note that I've dumped the numbers going into and out of the converter.  They're identical inputs, but completely different outputs from ConvertDataToPoint from when I first change the properties vs when I force a manual update.

Here is the converter

public class ChartDataToPixelsConverter : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        if (values == null || values.Length < 2)
            return DependencyProperty.UnsetValue;
 
        if (!(values[0] is RadCartesianChart chart))  // Must have a chart
            return DependencyProperty.UnsetValue;
 
        if (!(values[1] is double length))            // Must have a diameter value in mm
            return DependencyProperty.UnsetValue;
 
        if (!(values[2] is PointElement element))     // Are we returning X pixels or Y pixels?
            element = PointElement.X;
 
        if (element == PointElement.Y)
        {
            var p1 = chart.ConvertDataToPoint(new DataTuple(0, length));
            var p2 = chart.ConvertDataToPoint(new DataTuple(0, 0));
            var result = Math.Abs(p1.Y - p2.Y);
            Debug.WriteLine($"length {length.MM} => yHeight {result}");
            return result;
        }
        else
        {
            var p1 = chart.ConvertDataToPoint(new DataTuple(length, 0));
            var p2 = chart.ConvertDataToPoint(new DataTuple(0, 0));
            var result = Math.Abs(p1.X - p2.X);
            Debug.WriteLine($"length {length.MM} => xWidth {result}");
            return result;
        }
    }
 
    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        return Enumerable.Repeat(Binding.DoNothing, targetTypes?.Length ?? 0).ToArray();
    }
}

Here is the the  ContentTemplate where bind the ellipse height and width as I describe.  I've only shown the relevant part of the annotation style

<Style x:Key="ProfileCircleStyle"TargetType="{x:Type tk:CartesianCustomAnnotation}">
 
    <!-- The visual representation is a GreenYellow ellipse -->
 
    <Setter Property="ContentTemplate">
        <Setter.Value>
            <DataTemplate DataType="{x:Type tk:CartesianCustomAnnotation}">
                <Ellipse Fill="GreenYellow" d:DataContext="{d:DesignInstance {x:Type gci:IProfileOutputCircle}}">
                    <Ellipse.Width>
                        <!-- Converter only uses first 3 Binding elements.  Others are supplied merely
                        to trigger re-evaluation when the related properties change.  X-axis minimum is always zero -->
                        <MultiBinding Converter="{StaticResource CvtDataToPixels}" Mode="OneWay">
                            <Binding ElementName="MyChart"/>                       <!-- RadCartesianChart -->
                            <Binding Path="Diameter" />                            <!-- Diameter in mm -->
                            <Binding Source="{x:Static gcenum:PointElement.X}"/>   <!-- Return X pixels, not Y -->       
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type tk:RadCartesianChart}}" Path="Zoom"/>
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type tk:RadCartesianChart}}" Path="HorizontalAxis.(tk:LinearAxis.Maximum)"/>
                        </MultiBinding>
                    </Ellipse.Width>
                    <Ellipse.Height>
                        <!-- Converter only uses first 3 Binding elements.  Last two are supplied merely
                        to trigger re-evaluation when the related properties change -->
                        <MultiBinding Converter="{StaticResource CvtDataToPixels}" Mode="OneWay">
                            <Binding ElementName="MyChart"/>
                            <Binding Path="Diameter" />
                            <Binding Source="{x:Static gcenum:PointElement.Y}"/>
                    <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type tk:RadCartesianChart}}" Path="Zoom"/>
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type tk:RadCartesianChart}}" Path="VerticalAxis.(tk:LinearAxis.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type tk:RadCartesianChart}}" Path="VerticalAxis.(tk:LinearAxis.Maximum)"/>
                        </MultiBinding>
                    </Ellipse.Height>
                </Ellipse>
            </DataTemplate>
        </Setter.Value>
    </Setter>
 
</Style>


I've attached 3 images to show you what I see.  

1. The first attachment ("Correct-Normal-Scale.png") shows the chart as initially loaded.  The Ellipse is skewed horizontally because the chart axes are not equal scale.   But I'm using one size for both X and Y

Here is what my converter dumps for this.  The ellipse is correctly much wider than tall

    length 2.18513189968 => xWidth 516.7183886108953
    length 2.18513189968 => yHeight 48.07290179295998


2. The second attachment ("Incorrect-Equal-Scale.png") shows how it looks right after I check my "Equal Scale" checkbox at the bottom.  This causes me to manually set the axes min/max values (notice how they've changed).   Even though the X axis has changed dramatically, the ellipse remains skewed horizontally.  It should be a circle.

Here is what my converter dumps for this change.  Note that X hasn't changed much.  Y has not changed at all

    length 2.18513189968 => xWidth 503.74066305424367
    length 2.18513189968 => yHeight 48.07290179295998

3. Finally, I manually move the blue region just a tiny bit. This causes the binding to be reevaluated.   The 3rd Attachment ("Correct-Equal-Scale.png") shows how it looks right after.   Notice how the ellipse is now a perfect circle as it should have been. 

Here is what my converter dumps.  Notice how almost exactly the same input length value now produces identical width and height pixel values.

length 2.184046088752083 => xWidth 61.02891091119042
length 2.184046088752083 => yHeight 61.15329048505832

Martin Ivanov
Telerik team
 answered on 28 Apr 2020
2 answers
251 views

What I'd like to do is to be able to set it so the amount of text displayed in the columns is fixed and when the grid is resized the size of the font changes to keep the text displayed in each row fixed while having the number of rows shown vary as needed.

Using your Binding to 1 Million records Sample to show what I want, I took a screenshot stretched the grid by 50% in height and width to simulate text enlarging
as the window was widened, and then cropped out 5.5 of the 17 rows of data so that the number of rows visible was reduced because the height wasn't changed.

 

https://i.imgur.com/sctAk9F.png

Tran
Top achievements
Rank 1
 answered on 28 Apr 2020
2 answers
103 views

I am doing something very simple. I am trying to apply a simple style to a DateTimePicker.  Basically, if I use the line 

CalendarStyle="{StaticResource calendarStyle}", the drop down calendar doesn't show up. If I remove the line, the calendar works as expected. I'm using runtime version v4.0.30319, description is Progress® Telerik® UI for WPF. Here is the xaml:

<Window x:Class="RadDatePicker.MainWindow"
        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:local="clr-namespace:RadDatePicker"
        Title="MainWindow" Height="350" Width="935">
    <Window.Resources>
        <Style x:Key="calendarStyle" TargetType="telerik:RadCalendar">
            <Setter Property="AreWeekNumbersVisible" Value="True" />
        </Style>
    </Window.Resources>
    <Grid Height="207">
        <Border CornerRadius="6" >
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                <telerik:RadDatePicker x:Name="datePicker"
                   InputMode="DatePicker"
                   DisplayFormat="Short"
                   DateTimeWatermarkContent="Enter date"
                   DateSelectionMode="Day"
                   CalendarStyle="{StaticResource calendarStyle}" />
            </StackPanel>
        </Border>
    </Grid>
</Window>

 

Kathy
Top achievements
Rank 1
Veteran
 answered on 27 Apr 2020
4 answers
284 views
Hi, I'm a new developer in WPF.

I'm looking a way to validate a page of Wizard control when the "next" button is clicked. 
Basically I have a wizard where the first step check a connection with a SQL Database. This check is made from ViewModel. I need that when the Next is pressed the ViewModel do the check and if return "true" the wizard go to next step.

How I can do this?

I know how to call a command of ViewModel from Wizard but how I can tell "go ahead"?

Thanks.
enrico
Top achievements
Rank 1
Veteran
 answered on 27 Apr 2020
1 answer
93 views

Hi, 

     I'm develpoing a WPF application using GridView. In my scenario, some cells need to be merged Vertically, some cells while, need to be merged Horizontally. But the MergedCellsDirection property can not be set to two orientations at one time. Is any suggestions or mechanism for this problem?

     best regards

Yi

Yoan
Telerik team
 answered on 27 Apr 2020
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
PersistenceFramework
DataPager
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
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?