Telerik Forums
UI for WPF Forum
2 answers
143 views

I have experienced an error in RadCalendar where the years displayed are wrong, after navigating outwards from the current month to the current year and then again to the current decade and out to the current century and moving back and forth. The Text property is not dislaying the CalendarButtonContent Date. Why this happens is not something I am sure, but I set the Culture of the calendar to Norwegian bokmÃ¥l (nb-no). Let me show you how at least I managed to get the RadCalendar working again. 

First off in your resource file, define a style for the RadCalendar: 

<Style TargetType="{x:Type telerikInput:RadCalendar}"><Setter Property="FontFamily" Value="Segoe UI" /><Setter Property="FontSize" Value="9" />       <EventSetter Event="Loaded" Handler="RadCalendar_Loaded" /></Style>

The style got no key, so it will be the implicit style of any RadCalendar control/instance in your app. Ok, so now let's look at the EventSetter. 


 public void RadCalendar_Loaded(object sender, EventArgs e)         {             try             {                 var radCalendar = sender as RadCalendar;                 if (radCalendar != null)                 {                     radCalendar.Culture = new CultureInfo("nb-NO");                     radCalendar.DisplayModeChanged += radCalendar_DisplayModeChanged;                     radCalendar.DisplayDateChanged += radCalendar_DisplayDateChanged;                 }             }             catch (Exception) { }         }         void radCalendar_DisplayDateChanged(object sender, Telerik.Windows.Controls.Calendar.CalendarDateChangedEventArgs e)         {             AdjustRadCalendarDisplayYearsFix(sender);         }         void radCalendar_DisplayModeChanged(object sender, Telerik.Windows.Controls.Calendar.CalendarModeChangedEventArgs e)         {             AdjustRadCalendarDisplayYearsFix(sender);         }         private static void AdjustRadCalendarDisplayYearsFix(object sender)         {             //TA 11.11.2015: Resolution of the calendar bug observed when navigating years and decades in the calendar              var calendar = sender as RadCalendar;             if (calendar == null)                 return;             DispatcherUtil.DelayedInvokeAction(() =>             {                 var calendarButtons = calendar.ChildrenOfType<CalendarButton>().ToList();                 if (calendarButtons.Any())                 {                     foreach (var c in calendarButtons.Where(cb => cb.ButtonType == CalendarButtonType.Year || cb.ButtonType == CalendarButtonType.Decade))                     {                         try                         {                              if (c.DataContext is CalendarButtonContent)                             {                                 var cbc = c.DataContext as CalendarButtonContent;                                 var tb = c.FindChildByType<TextBlock>();                                 if (tb != null)                                     tb.Text = cbc.ButtonType == CalendarButtonType.Year ? cbc.Date.ToString("yyyy") :                                          cbc.Date.ToString("yyyy") + "-" + cbc.Date.AddYears(10).ToString("yy");                             }                         }                         catch (Exception err)                         {                             Debug.WriteLine(err.Message);                         }                     }                 }             }, 500);         }

Ok, so we also use something called DelayedInvokeAction here:

      /// <summary>         /// Executes an action passed into this method by a timeout measured in milliseconds         /// </summary>         /// <param name="executeAction">Action to execute</param>         /// <param name="timeOut">The timeout to wait before executing (in milliseconds)</param>         /// <param name="priority"></param>         ///    /// <param name="keyToken">A key token to identity the switch (basic grouing). Will be used as a tag on the DispatcherTimer</param>         public static bool DelayedInvokeAction(Action executeAction, int timeOut, DispatcherPriority priority = DispatcherPriority.Background, Guid? keyToken = null)         {             var delayedAction = new DelayedAction(executeAction, timeOut, keyToken);             ActionsRegistered.Add(delayedAction);             DispatcherTimer dtimer = new DispatcherTimer(priority);             dtimer.Interval += new TimeSpan(0, 0, 0, 0, timeOut);             dtimer.Tag = delayedAction.ExecuteGuid;             dtimer.Tick += DelayedInvokeTimerTick;             dtimer.IsEnabled = true;             dtimer.Start();             return true;         }
public class DelayedAction     {         private readonly Action actionToExecute;         private readonly int timeOut;         private readonly Guid executeGuid;         public Action ActionToExecute         {             get { return actionToExecute; }         }         public int TimeOut         {             get { return timeOut; }         }         public Guid ExecuteGuid         {             get { return executeGuid; }         }         public DelayedAction(Action actionToExecute, int timeOut, Guid? keytoken)         {             this.actionToExecute = actionToExecute;             this.timeOut = timeOut;             this.executeGuid = keytoken ?? Guid.NewGuid();         }     }


Hope this helps!

Geri
Telerik team
 answered on 16 Nov 2015
4 answers
205 views

Dear Team,

I am using the docking custom property provider to save the state of my layout. When i reload the layout i can able to load the three different radpane in the specified position but data is not loading. please help to check and advise on this issue.

<Grid>
       <Grid Opacity="{Binding MainGridOpacity}">   
           <telerik:RadDocking x:Name="radDocking"
                               HasDocumentHost="False">
               <telerik:RadDocking.DocumentHost>
               <telerik:RadSplitContainer ScrollViewer.VerticalScrollBarVisibility="Auto">
                   <telerik:RadSplitContainer Orientation="Vertical" telerik:ProportionalStackPanel.RelativeSize="70, 100">
                       <telerik:RadPaneGroup>
                           <telerik:RadPane x:Name="radPane1"
                                            Header="Dashboard"
                                            telerik:RadDocking.SerializationTag="radPane1">
                               <Grid>
                                   <Grid.RowDefinitions>
                                       <RowDefinition Height="Auto" />
                                       <RowDefinition Height="Auto" />
                                       <RowDefinition Height="Auto" />
                                   </Grid.RowDefinitions>
                                   <StackPanel>
                                       <telerik:RadTabControl Width="Auto"
                                                              VerticalAlignment="Stretch"
                                                              x:Name="radDashboardTabControl">
                                       </telerik:RadTabControl>
                                   </StackPanel>
                               </Grid>
                           </telerik:RadPane>
                       </telerik:RadPaneGroup>
                   </telerik:RadSplitContainer>
                   <telerik:RadSplitContainer Orientation="Vertical"
                                              InitialPosition="DockedRight"
                                              telerik:ProportionalStackPanel.RelativeSize="30, 100">
                       <telerik:RadSplitContainer Orientation="Horizontal">
                           <telerik:RadPaneGroup telerik:ProportionalStackPanel.RelativeSize="50, 50">
                               <telerik:RadPane Header="ApplicationInfo"
                                                telerik:RadDocking.SerializationTag="ApplicationInfo">
                                   <!--<ScrollViewer VerticalScrollBarVisibility="Auto">-->
                                       <StackPanel>
                                           <TextBlock Text="{Binding AppNo}" />
                                           <ContentControl x:Name="appInfoControl" />
                                       </StackPanel>
                                   <!--</ScrollViewer>-->
                               </telerik:RadPane>
                           </telerik:RadPaneGroup>
                       </telerik:RadSplitContainer>
                       <telerik:RadSplitContainer Orientation="Horizontal">
                           <telerik:RadPaneGroup x:Name="radPaneGroup1" telerik:ProportionalStackPanel.RelativeSize="50, 50">
                               <telerik:RadPane x:Name="radPane11"
                                                Header="WorkLoad"
                                                telerik:RadDocking.SerializationTag="radPane11">
                                   <ScrollViewer Visibility="Visible"
                                                 HorizontalScrollBarVisibility="Visible">
                                       <ContentControl x:Name="workLoadControl" />
                                   </ScrollViewer>
                               </telerik:RadPane>
                           </telerik:RadPaneGroup>
                       </telerik:RadSplitContainer>
                   </telerik:RadSplitContainer>
               </telerik:RadSplitContainer>
               </telerik:RadDocking.DocumentHost>
           </telerik:RadDocking>
       </Grid>
       <Grid>   
           <StackPanel Margin="3">
               <telerik:RadButton Margin="0 2" Width="200"
                                  Content="Save Layout"
                                  Click="OnSave"
                                  x:Name="buttonSave" />
               <telerik:RadButton Margin="0 2"
                                  Width="200"
                                  Content="Load Layout"
                                  Click="OnLoad"
                                  x:Name="buttonLoad" />
           </StackPanel>
       </Grid>
   </Grid>
DashboardGridView.XMAL.cs

public partial class DashboardGridView : UserControl
    {
 System.IO.Stream stream;
        public DashboardGridView()
        {
ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(Telerik.Windows.Controls.RadDocking), new DockingCustomPropertyProvider());
}
 private void OnSave(object sender, System.Windows.RoutedEventArgs e)
        {
            PersistenceManager manager = new PersistenceManager();
            this.stream = manager.Save(this.radDocking);
            this.EnsureLoadState();
            using (FileStream file = new FileStream(@"C:\temp\file.bin", FileMode.Create, System.IO.FileAccess.Write))
            {
                byte[] bytes = new byte[stream.Length];
                stream.Read(bytes, 0, (int)stream.Length);
                file.Write(bytes, 0, bytes.Length);
                stream.Close();
            }
        }
 
        private void OnLoad(object sender, System.Windows.RoutedEventArgs e)
        {
            using (stream = new MemoryStream())
            {
                using (FileStream file = new FileStream(@"C:\temp\file.bin", FileMode.Open, FileAccess.Read))
                {
                    byte[] bytes = new byte[file.Length];
                    file.Read(bytes, 0, (int)file.Length);
                    stream.Write(bytes, 0, (int)file.Length);
                }
                this.stream.Position = 0L;
                PersistenceManager manager = new PersistenceManager();
                manager.Load(this.radDocking, this.stream);
                this.EnsureLoadState();
            }
        }
        private bool CanLoad()
        {
            return this.stream != null && this.stream.Length > 0;
        }
 
        private void EnsureLoadState()
        {
            this.buttonLoad.IsEnabled = this.CanLoad();
        }
}

Martin Ivanov
Telerik team
 answered on 16 Nov 2015
1 answer
228 views

 

This is urgent since I can't do anything else on my WPF app until this gets figured out! 

I was trying to add a RadCartesianChart on an existing WPF project and I was having the following error message on the designer view(even though it would compile and run normally):

[System.InvalidOperationException
Sequence contains more than one element
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.DefineGenericParameters(Type type, MockTypeDefinition mockType)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.PopulateMockType(Type type, MockTypeDefinition mockType)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.DefineType(Type type)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.MockGenericType(Type type)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.DefineType(Type type)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeGenerator.DefineProperty(TypeDefinition typeDefinition, PropertyInfo propertyInfo)....]

 

I tried a bunch of different things and the error remained, so I decided to create a new WPF project and paste some code from the RadChartView - Getting Started topic on http://docs.telerik.com/ and then I got
[System.NullReferenceException
Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.MockTypeDefinition.ImplementAbstractEvent(EventDefinition eventDefinition, Boolean shouldOverride, Action`3 emitAddMethodBody, Action`3 emitRemoveMethodBody)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockTypes.InterfaceEmitterFactory.DefaultInterfaceEmitter.ImplementEvent(EventDefinition eventDefinition, Boolean shouldOverride)...]

I don't know if it helps but I attached an image of what the error looks like on the second case.

Peshito
Telerik team
 answered on 16 Nov 2015
5 answers
172 views

Hi,

I use INotifyLocationChanged to raise event when items of a VisualizationLayer move and it throws an exception in some particular case. I've joined a sample project that demonstrate this particular case. I'm I doing something wrong or this is a bug ?

Thank you,

Etienne

Martin Ivanov
Telerik team
 answered on 16 Nov 2015
3 answers
114 views

Hi,

 I've implemented the ScheduleView via my own models implementing the IAppointment interface.

In the normal Week view everything works fine, but as soon as I add a grouped view to the ScheduleView no appointments are displayed (although they are correctly loaded in the viewmodel).

The XAML I add:

<telerik:RadScheduleView.GroupDescriptionsSource>
                <telerik:GroupDescriptionCollection>
                    <telerik:ResourceGroupDescription ResourceType="Mitarbeiter"/>
                    <telerik:DateGroupDescription />
                </telerik:GroupDescriptionCollection>
</telerik:RadScheduleView.GroupDescriptionsSource>

 

Any suggestion what I'm doing wrong?

 thx​

Stefan
Top achievements
Rank 1
 answered on 16 Nov 2015
1 answer
397 views

I'm new to this so I'm hoping to find some direction.  I have a plot on in a RadCartesianChart.  I want to be able to right-click and capture the location of the mouse at that place. Before we had a double click mouse event and were able to do this:

1.private void ChartSelectionBehavior_SelectionChanged(object sender, Telerik.Windows.Controls.ChartView.ChartSelectionChangedEventArgs e)
2.{
3.     if (e.AddedPoints.Count > 0)
4.     {
5.          ViewModel.NotePoint = e.AddedPoints[0].DataItem as GraphPlots;
6.     }
7.}​

Now I have this:

private void standardGraph_MouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
     //I want to set the NotePoint of the View Model to the location
     //of the right-mouse click here
      
     plotContextMenu.Visibility = System.Windows.Visibility.Visible;
}​

I can get the location of the MouseButtonEvent, but once I do I'm not sure how to set it as a GraphPlot.

Here's my XML:

01.<telerik:RadCartesianChart Visibility="{Binding StdGraphVisibility}"
02.     x:Name="standardGraph"
03.     Height="500"
04.     Width="1000"
05.     MouseRightButtonDown="mouseRightButtonDown"
06.     MouseRightButtonUp="standardGraph_MouseRightButtonUp">
07.                                         
08.    <telerik:RadContextMenu.ContextMenu>
09.                                             
10.        <telerik:RadContextMenu x:Name="plotContextMenu"
11.            Visibility="Hidden">
12. 
13.            <telerik:RadMenuItem Header="Add note"
14.                x:Name="addNoteMenuItem"
15.                Click="addNoteMenuItem_Click" />
16. 
17.            </telerik:RadContextMenu>
18.        </telerik:RadContextMenu.ContextMenu>
19.           
20.        <telerik:RadCartesianChart.Behaviors>
21.         
22.            <telerik:ChartSelectionBehavior DataPointSelectionMode="Single" 
23.                SelectionChanged="ChartSelectionBehavior_SelectionChanged"/>
24. 
25.        </telerik:RadCartesianChart.Behaviors>
26.                             
27.        <telerik:RadCartesianChart.HorizontalAxis>
28.        </telerik:RadCartesianChart.HorizontalAxis>
29.         
30.        <telerik:RadCartesianChart.VerticalAxis>  
31.        </telerik:RadCartesianChart.VerticalAxis>
32.                             
33.        <telerik:RadCartesianChart.Grid>
34.         
35.            <chartView:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y" />
36.             
37.        </telerik:RadCartesianChart.Grid>
38. 
39.        <telerik:RadCartesianChart.Series>
40.            <telerik:LineSeries Stroke="Orange"
41.                CategoryBinding="Category"
42.                ValueBinding="Value"
43.                ItemsSource="{Binding GraphValue}">
44.            </telerik:LineSeries>
45.             
46.        <telerik:PointSeries CategoryBinding="Category"
47.            ValueBinding="Value"
48.            ItemsSource="{Binding Notes}">
49.        </telerik:PointSeries>
50.    </telerik:RadCartesianChart.Series>
51.</telerik:RadCartesianChart>
 

Petar Marchev
Telerik team
 answered on 16 Nov 2015
2 answers
350 views

We have a existing project that uses some older telerik libraries.
This application uses the RadRibbonView inside of an ElementHost control. It works great with the older telerik libraries.

I upgraded to the latest 2015 Q3 binaries and I am having problems.

The ribbon no longer displays in the element host.

I did some sanity checks by putting other telerik components into the element host, and they display fine.

Attached is a simple project that reproduces the issue.

Basically it creates a usercontrol.
Adds a simple ribbonview
Adds this ribbon view to a win forms control via element host.

Link to the project:
https://goo.gl/vJv5BG

 

Kiril Vandov
Telerik team
 answered on 16 Nov 2015
4 answers
138 views
Hi, I've been trying to use CodedUI test in Visual Studio 2013 but I got all these error messages.
I've looked up the documentation for UI for WPF and found that only Visual Studio 2010 and 2012 are supported.
I was wondering if and when you are planning to release dlls for CodedUI test for Visual Studio 2013.
Thanks!
Maya
Telerik team
 answered on 16 Nov 2015
3 answers
200 views

Hey, I'm doing automated UI testing on a WPF application and we want to test exporting a table into multiple formats. The issue I'm having is that I can't seem to change the "Save as type" drop down menu in the save dialog. I'm using this script to save the file right now:

 

SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveApplication, DialogButton.SAVE, @"C:\test " + date);
Manager.DialogMonitor.AddDialog(saveDlg);
Manager.DialogMonitor.Start();
 

// Click export button script

 
saveDlg.WaitUntilHandled(30000);
Manager.DialogMonitor.Stop();​

Cody
Telerik team
 answered on 13 Nov 2015
3 answers
197 views
Hello,

I use RadCarousel to show  photograph of persons in the HR module. If the user changes a person's photograph, how can I update only this single image in the RadCarousel, without reread all pictures? I use DataTemplate for the CarouselItemTemplate, a short video about it: http://www.youtube.com/watch?v=b3DCjnU-CyU .

I use PowerBuilder 12.1 .NET, so I can use only very simple things, I can’t define e.g. event handler. After I started to use this DataTemplate, the Reflection has disappeared, how can I start it again?

Thank you very much!

Péter Tóth

Martin Ivanov
Telerik team
 answered on 13 Nov 2015
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?