Telerik Forums
UI for WPF Forum
3 answers
265 views
I have an object that I have some data in. The object has the following properties

Description
Amount
Date

I want to plot a chart where Date would be in X axis and Amount will be on Y (which is easy). If I just set the ItemsSource and the X and Y properties, this works fine.

However for each distinct description I want to show a new series. But I want to keep this dynamic. so if there is Series 1 and Series 2 in Description, then only two would show, if there is more than 2 then all would show. How is this doable?

Petar Marchev
Telerik team
 answered on 15 Oct 2014
8 answers
176 views
Hi

  I don't know what I am asking is can be done, but have to try a shot, Currently using Schedule view for my project, and on that as you people know there is Day,Week,Month and timeline option on it, what I am expecting is, can Onclick event can be done  on "Day" or "week" so that  it can trigger method in viewmodel(class file) currently this click option is nothing to do with Viewmodel, the reason I need this because, if employee has an many appointments Ex 1000, it takes time to load all the 1000 values,so what I need is on page load it should show only todays appointments, on selection of "Week" it should call a method and pass the week parameters to get only week's appointment and so on, I want to get appointment based on selection of Day or Month it has to load only based on that Selection event, not the entire future appointment list, hope I made it understand , Please let me know for any clarification, and I am attaching the pic of existing view of mine, so please guide me in this, any help is appreciated, thanks :)
Kalin
Telerik team
 answered on 15 Oct 2014
1 answer
122 views
Hi

We are trying to do custom sorting per grouping in a datagrid and I've been unable to find any examples. Say we have 2 groups, foo and bar, and we want to sort the row on 2 different properties. The groups are, in this particular example, known and I somehow like to specify a GroupSortingExpression per grouping. 

In the attached screenshot, I would like to sort the group 'group-1' by foo and the group 'group-2' by bar. Is this possible?

Any hints are greatly appreciated!
Regards
/Jasper

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Telerik.Windows.Data;
 
namespace WpfApplication2
{
    public class DataItemCollection
    {
        private ObservableCollection<DataItem> _internalItems;
        public ObservableCollection<DataItem> Items
        {
            get
            {
                return _internalItems ?? (_internalItems = new ObservableCollection<DataItem>
                {
                    new DataItem("group-1", "bar-1", "foo-1", new DateTime(2000, 01, 2)),
                    new DataItem("group-1", "bar-3", "foo-3", new DateTime(2000, 01, 1)),
                    new DataItem("group-1", "bar-2", "foo-0", new DateTime(2000, 01, 1)),
                    new DataItem("group-2", "bar-4", "foo-4", new DateTime(2000, 01, 1)),
                    new DataItem("group-2", "bar-2", "foo-2", new DateTime(2000, 01, 4)),
                    new DataItem("group-2", "bar-5", "foo-5", new DateTime(2000, 01, 3))
                });
            }
        }
    }
 
    public class DataItem
    {
        public DataItem(string @group, string bar, string foo, DateTime date)
        {
            Group = @group;
            Bar = bar;
            Foo = foo;
            Date = date;
 
            GroupingInfo = new DataGroupingInfo(@group);
 
             
        }
 
        public string Foo { get; set; }
 
        public string Group { get; set; }
 
        public string Bar { get; set; }
 
        public DateTime Date { get; set; }
 
        public DataGroupingInfo GroupingInfo { get; set; }
    }
 
    public class DataGroupingInfo : IEquatable<DataGroupingInfo>, IComparable<DataGroupingInfo>, IComparable
    {
        public DataGroupingInfo(string p1)
        {
            Property1 = p1;
        }
 
        public string Property1 { get; set; }
 
        public bool Equals(DataGroupingInfo other)
        {
            return other.Property1 == Property1;
        }
 
        public int CompareTo(DataGroupingInfo other)
        {
            return String.Compare(Property1, other.Property1, StringComparison.Ordinal);
        }
 
        public override int GetHashCode()
        {
            return (Property1 != null ? Property1.GetHashCode() : 0);
        }
 
        public int CompareTo(object obj)
        {
            return CompareTo((DataGroupingInfo) obj);
        }
    }
 
    public class DataItemInfoGroupDescriptor : GroupDescriptor<DataItem, DataGroupingInfo, string>
    {
        public DataItemInfoGroupDescriptor()
        {
            GroupingExpression = t => t.GroupingInfo;
             
            GroupSortingExpression = g => g.Key.Property1;
        }
 
        public override ListSortDirection? SortDirection
        {
            get { return ListSortDirection.Ascending; }
        }
    }
}

Dimitrina
Telerik team
 answered on 15 Oct 2014
4 answers
376 views
Hi There,

when the RadWatermarkTextBox is readonly and then we focus the RadWatermarkTextBox on pressing tab I have to set "FocusedVisual" border to "collapsed"(In the Template), but when user tries focus the text box then the "FocusedVisual" should be enabled. can you please help us.

Here is my style:

<Style x:Key="RadWatermarkTextBoxStyle" TargetType="telerik:RadWatermarkTextBox">
        <Setter Property="CaretBrush" Value="#FF516066"/>
        <Setter Property="Height" Value="24"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="4,0"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadWatermarkTextBox">
                <Grid x:Name="RootElement" Cursor="IBeam">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF0166A1" Storyboard.TargetName="Border"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ReadOnlyVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="FocusedVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid"/>
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ThicknessAnimation Duration="0" To="1" Storyboard.TargetName="ValidationErrorVisual" Storyboard.TargetProperty="BorderThickness"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ThicknessAnimation Duration="0" To="2" Storyboard.TargetName="ValidationErrorVisual" Storyboard.TargetProperty="BorderThickness"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="WatermarkStates">
                                <VisualState x:Name="WatermarkHidden"/>
                                <VisualState x:Name="WatermarkVisible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="WatermarkVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>
                                                        Visible
                                                    </Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="WatermarkVisual"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="BaseBorder" Background="#FFFFFFFF" Margin="1"/>
                        <Border x:Name="ReadOnlyVisual" Background="#FFDFE3E6" BorderBrush="#FFA6A6A6" BorderThickness="1" Opacity="0"/>
                        <Border x:Name="Border" BorderThickness="1" BorderBrush="#FF8F8F8F"/>
                        <ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" BorderThickness="0" IsTabStop="False"/>
                        <Border x:Name="MouseOverVisual" BorderThickness="2" BorderBrush="Transparent"/>
                        <Border x:Name="FocusedVisual" BorderThickness="2" BorderBrush="#FF0166A1" IsHitTestVisible="False" Opacity="0"/>
                        <Border x:Name="DisabledVisual" Background="#A5F7F7F7" BorderBrush="#A5F7F7F7" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" IsHitTestVisible="False"/>
                        <Border x:Name="ValidationErrorVisual" BorderThickness="2" BorderBrush="Red" Visibility="Collapsed"/>
                        <ContentControl x:Name="WatermarkVisual" Visibility="Collapsed" Content="{TemplateBinding WatermarkContent}" ContentTemplate="{TemplateBinding WatermarkTemplate}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Margin="6,0" />
                        <Border Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip 
x:Name="ValidationTooltip" 
PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Content="{Binding Path=(Validation.Errors),Converter={StaticResource validationErrorConverter}}"/>
                            </ToolTipService.ToolTip>                            
                        </Border>
                       </Grid>
                </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





Ravi
Top achievements
Rank 1
 answered on 15 Oct 2014
1 answer
432 views
Hello,
In this demo: http://demos.telerik.com/silverlight/#ImageEditor/Cropping you use BitmapToRadBitmapImageConverter. Can you please share the code for the converter?

I suppose it is something like this:

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var image = value as BitmapImage;
            if(image != null)
                return new RadBitmap(image);

            return null;
        }

But will be good to have the original code.

Regards,
Saykor
Petya
Telerik team
 answered on 14 Oct 2014
3 answers
1.1K+ views
I am using the the Windows7Theme for my application and I want to do so for RadToggleButtons too...but I need it to have a more pronounced background color when checked (like the Office Blue theme which highlights the control in yellow). What is the easiest way to accomplish this?

Thanks.
Martin Ivanov
Telerik team
 answered on 14 Oct 2014
5 answers
72 views
We have the "TileReorderMode" property set to "None" - but when using your finger to scroll left and right the tiles they still move up and down somewhat -- which messing with scrolling smoothly.  Is there a way to stop this individual tile movement?

When we have the tile's "InEnabled" set to "False" - this allows for the desired smooth scrolling - but still need a way to trigger actions when clicking / touching the tiles -- and can't get any events to fire when tiles are disabled...

Would love a solution for either of the two situations above...
Yoan
Telerik team
 answered on 14 Oct 2014
1 answer
198 views
Hello

I have some problems with drag and drop inside RadListBox. Everything is fine but it only works for first element in RadListBox - I mean that I can drag only first item down in any place, but only the first one. When I create a separate project everything works fine but it is not working in my application. I can't send any example of it and that a shame but I have a question. Is it possible that only first element can be dragged? 

What can be wrong, maybe some property needs to be set for other items when drag is being initialized? OnDragInitializeHandler is being fired but nothing after that. Many thanks for your advice.
Nasko
Telerik team
 answered on 14 Oct 2014
26 answers
582 views
I have a parent grid which has a child RadGridView in the HierarchyChildTemplate. And i have the same columns for both parent and children rows. I want to apply all the operations that are done on the parent to be propagated to children, like when i resize the parent column i want the corresponding column in child also to be resized and when i reorder the column of the parent, i want the children columns also to be reordered and when i move the FrozenColumns bar to some columns in parent, i want the child grid also to Freeze the same number of columns etc. In short, i want the control to behave the same way as RadTreeListView for hierarchy. I found that i can use events ColumnWidthChanged, ColumnReordered for resize and reorder, but i didn't find any event for change of FrozenColumns. 

And do i need to rewrite all my triggers and behaviors present on the parent Grid in the Child Grid to apply on the child? Or is there any way to propagate all the operations done on parent columns automatically to children? If no, do you have a sample template to propagate all the changes made on the parent columns to the child grid?
Vanya Pavlova
Telerik team
 answered on 14 Oct 2014
2 answers
122 views
Hi,

I'm trying to add a contextual menu to a MapPathView and I encountered some problems.

Here's what I have :

DataTemplate:
                    <DataTemplate x:Key="ZoneTemplate" DataType="ZoneViewModel">
                        <telerik:MapPathView>
                            <telerik:MapPathView.Data>
                                <.../>
                            </telerik:MapPathView.Data>
                            <telerik:RadContextMenu.ContextMenu>
                                <telerik:RadContextMenu>
                                    <telerik:RadMenuItem Header="Remove" Command="{Binding DataContext.RemoveZoneCommand, Source={x:Reference parentControl}}" CommandParameter="{Binding}"/>
                                </telerik:RadContextMenu>
                            </telerik:RadContextMenu.ContextMenu>
                        </telerik:MapPathView>
                    </DataTemplate>

VisualizationLayer:
                <telerik:VisualizationLayer UseDefaultPropertyAccessor="False" UseBitmapCache="False"
                                            ItemsSource="{Binding Path=CurrentZones}" ItemTemplate="{StaticResource ZoneTemplate}"
                                            MapShapeVisualizationCreated="OnVisualizationCreated" MapShapeVisualizationRemoved="OnVisualizationRemoved">
                    <telerik:VisualizationLayer.ShapeFill>
                        <telerik:MapShapeFill Fill="Blue" StrokeThickness="1" Stroke="Red" />
                    </telerik:VisualizationLayer.ShapeFill>
                </telerik:VisualizationLayer>

VisualizationCreatedEvent:
        private void OnVisualizationCreated(object sender, MapShapeOperationEventArgs e)
        {
            if (e.Visualization != null)
            {
                var dataContext = e.Data.Wrapper.DataContext as ZoneViewModel;
                if (dataContext != null)
                {
                    ...
                    var contextMenu = RadContextMenu.GetContextMenu(e.Data.Wrapper);
                    RadContextMenu.SetContextMenu(e.Visualization, contextMenu);
                    contextMenu.DataContext = dataContext;
                }
            }
        }

The contextual menu shows as expected, but the command parameter is not a ZoneViewModel as I expected, it's a PathData.
Do you have any idea of what is the problem ?

Thank you!

Etienne
Petar Mladenov
Telerik team
 answered on 14 Oct 2014
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
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?