Telerik Forums
UI for WPF Forum
1 answer
194 views
I'm having difficulty displaying design-time data in a user control that makes heavy use of RadMap.
The method I use for design-time is similar to the Sophia Car Rental project. I set the data context in the UserControl tag as follows:

             xmlns:design="clr-namespace:XYZ.ViewModel.Design"
             d:DataContext="{d:DesignInstance d:Type=design:PlanViewModel, d:IsDesignTimeCreatable=True}"

I then create a class that inherits from my run-time view model, but is used to put some dummy data on the screen. Here I am adding an information layer and setting the background to blue so I can see it. Also note the compiler directives to keep this design-time stuff out of my release a..

#if DESIGNONLY
using System.Windows.Media;
using Telerik.Windows.Controls.Map;

namespace XYZ.ViewModel.Design
{
    public class PlanViewModel : PlanView.PlanViewModel
    {
        public override void SetControlState(bool resetToInitialState = false)
        {
            base.SetControlState(resetToInitialState);

            var layer = new InformationLayer
            {
                Background = Brushes.Blue
            };
            Layers.Add(layer);
        }
    }
}
#endif

Lastly, this happens in the SetControlState() method, which in this case is called in the base class when the map's InitializationCompleted method is called.
The Layers Collection is defined as such;

        public ObservableCollection<InformationLayer> Layers { get; private set; }

and the user control definition looks like this;

        <telerik:RadMap HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                        ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}" Center="{Binding Center, Mode=TwoWay}"
                        UseDefaultLayout="False" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
                        x:Name="MapContainer" ItemsSource="{Binding Layers}">
            <!-- Send the mouse position to the view model so we can fake the mouse position control with our own data -->
            <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding MousePositionCommand}" EventName="MouseMove"
                                      PassEventArgsToCommand="True" RaiseOnHandledEvents="True"/>
            </telerik:EventToCommandBehavior.EventBindings>
            <!-- This provider gives us a blank slate that can handle UTM based data -->
            <telerik:RadMap.Providers>
                <telerik:EmptyProvider>
                    <telerik:EmptyProvider.Projection>
                        <telerik:EPSG900913Projection />
                    </telerik:EmptyProvider.Projection>
                </telerik:EmptyProvider>
            </telerik:RadMap.Providers>
        </telerik:RadMap>

If I create the InformationLayer in XAML, I see a blue map as expected. If I do it in code - nothing. This technique works perfectly with other controls, so I'm somewhat at a loss as to what is happening, especially since similar code at run time creates a map with an InformationLayer with a blue background.

Any suggestions are welcome.

Petar Mladenov
Telerik team
 answered on 23 Dec 2014
1 answer
198 views
Hi,

I use a treeview with LoadOnDemand enabled. When I expand a node it seems that the property IsExpanded switch from False to True (normal) + switch from True to False (i dont understand) and finally from False to True. We can imagine that final status is the goal, BUT when i expand an empty node the final switch (False to True) dont occurs (think its link with observablecollection)
I join a sample here post. If you open the Root node + open Item node and then try to open empty node SubItem you will see that SubItem IsExpanded property stay false.
What's the issue ?
Regards
Luc 
Petar Mladenov
Telerik team
 answered on 22 Dec 2014
2 answers
93 views
Hi all!
I'm using custom TiledMapSource, which takes tiles from the file system.
But I want to hide tiles from enduser and place them inside the resource pack of the application.

I tried to set tile files to build action "Resource" and giving URI like "pack://application:,,,/MyAssemble;component/tiles/z0/0/x0/0/y0.png"
But tiles doesn't appear on the map.

Is it possible to store and use tiles from application resources ?
Petar Mladenov
Telerik team
 answered on 19 Dec 2014
6 answers
224 views
I would like to change custom style for RadpanelBar to display the arrow on the left instead of on the right side.
How can I customize it?  Also, when the row is expanded, the arrow will display differently.

Ram
Top achievements
Rank 1
 answered on 19 Dec 2014
1 answer
93 views
Every time I use the RadWindow i get this exception at design time:

It's impossible to cast 'Microsoft.Expression.DesignSurface.View.ArtboardBorder' on type 'System.Windows.Window'

At runtime everything works fine.
Kalin
Telerik team
 answered on 19 Dec 2014
5 answers
141 views
Hi guys,

I get the following issue on the version 2014.2.0617.45:

When I select one row on top of the grid, then scroll down, and try to select other row - all the pages in between are getting loaded. The issue haven't reproduced on earlier version (2013.2.724.40).

Here is the code to reproduce the problem:
View:

<Window x:Class="RadGridView_Virtualization.MainWindow"
        xmlns:local="clr-namespace:RadGridView_Virtualization"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <local:MyViewModel x:Key="MyViewModel" />
    </Window.Resources>
         
    <Grid DataContext="{StaticResource MyViewModel}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <telerik:RadGridView x:Name="gridAccessList"
                              Height="240"
                              Width="370"
                             IsFilteringAllowed="False" CanUserReorderColumns="True"
                              AutoGenerateColumns="False"
                              ItemsSource="{Binding Path=Items}"
                             EnableRowVirtualization="True"
                             SelectionMode="Extended"
                             ScrollViewer.IsDeferredScrollingEnabled="True" IsReadOnly="True"
                             ShowGroupPanel="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}"
                                                            Width="*"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

ViewModel:

using System.Collections.Generic;
using System.ComponentModel;
using Telerik.Windows.Data;
 
namespace RadGridView_Virtualization
{
    public class MyViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
 
        public MyViewModel()
        {
            Items = new VirtualQueryableCollectionView<DummyData>
              {
                VirtualItemCount = LoadSize, LoadSize = this.LoadSize
              };
 
          Items.ItemsLoading += OnItemsLoading;
        }
 
    private void OnItemsLoading(object sender, VirtualQueryableCollectionViewItemsLoadingEventArgs args)
    {
      Items.VirtualItemCount = 35000;
 
      Source = new List<DummyData>();
 
      for (int i = 0; i < args.ItemCount; i++)
      {
        Source.Add(new DummyData { Id = args.StartIndex + i });
      }
 
      Items.Load(args.StartIndex, Source);
    }
 
      private List<DummyData> source;
        public List<DummyData> Source
        {
            get { return this.source; }
            set { this.source = value; }
        }
 
        private int loadSize = 100;
        public int LoadSize
        {
            get { return loadSize; }
            set { loadSize = value; }
        }
 
        public VirtualQueryableCollectionView<DummyData> Items { get; private set; }
 
        public class DummyData
        {
            public int Id { get; set; }
        }
    }
}

If you put a breakpoint in OnItemsLoading method - you'll see that grid requests all pages between two selected rows. Please, note, that it happens after regular single row selection, so no data pages in the middle of two selected rows are not needed.
Nick
Telerik team
 answered on 19 Dec 2014
3 answers
263 views
I have two issues with the RadTreeListView control. 

1)Performance sucks on the UI load for the expansion of rows with MVVM. The issue I have is I maintain the state of the collapsed and expanded nodes. Let's say my Nodes are all expanded. I set my datasource.
The control draws them all collapsed, then "pops" then expands them all. Looks like crap. i.e. I do a "refresh" on my datasource and reset the collection and all the items collapse then expand again. Looks pretty bad.


2) I spent hours trying to figure this out to no avail. I am refreshing my datasource and I tried to ways to set my selected item. 
1) using the IsSelected property. Which should have been good enough since I store that value and load it with my objects. (And yes, I had the row databinding style which would have been nice if you had that supported like the IsExpandedBinding property)
2) Setting my SelectedItem property on my VM. Which is bound two way to the grid.

I set it before. I set it after the ItemSource update. I always just get the first item in the dataset to appear selected.

I am using an observablecollection for the ItemsSource.

Maybe I am missing something obvious, but the control isn't feeling very solid to me so far.





Nick
Telerik team
 answered on 19 Dec 2014
1 answer
169 views
RadRichTextBox Header and Footer places can not show images in WPF. When I open a word docx file header images are remove.
Boby
Telerik team
 answered on 19 Dec 2014
3 answers
141 views
Hi,

Can you guide me on the simplest way of how I can change the Background of an Selected Appointment ?
I also want to customize the Opacity and the Border and also all this when hover on it.

I successfully changed different properties of an appointment, but I'm not sure how to change the selected properties.

Thanks,
Daniel
Kalin
Telerik team
 answered on 19 Dec 2014
10 answers
315 views

I have two issues:

1) On data type validation, I see the row highlight but do not see any error message as a comment that I see in DataAnnotations Support demo

2) How do I add validations like Required field validation or any custom validation at runtime.

I am using 2013.2.724.45 version of telerik controls.

Dimitrina
Telerik team
 answered on 19 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?