Telerik Forums
UI for WPF Forum
4 answers
134 views
Hi all!

I have successfully implemented custom themes (telerik approach) for 2011 Q2 version
of gauges in VS 2010. I was using "Creating and applying a custom theme for RadScheduler for WPF" as help.

Yesterday I installed 2011 Q3 RAD controls and tried to implement new gauges and they are looking
beautiful and are working fine. I also created another custom theme project for new gauges, but I'm
having problems with resources files :( I used templates from Telerik theme samples.
I tried different approaches defining Resources in custom themes library. But I was either getting error
"invalid ThemeType" or "Cannot locate resource 'themes/gauge/customdarkq3/styles.xaml'".

Has procedure for custom themes changed for Q3 version of controls? I noticed there are now 2
gauges xaml files (Gauge.xaml and Gauge_New.xaml). Any suggestion on how to approach this problem?

Regards, Max

Max
Top achievements
Rank 1
 answered on 28 Nov 2011
1 answer
72 views
hello

I have a line graph in WPF and I want to do is just leave the points as you can get an example in the picture.

thanks
Evgenia
Telerik team
 answered on 28 Nov 2011
3 answers
537 views
I'm using RadMap in an MVVM pattern, so I'm not able to get a reference to the map or the InformationLayer so that I can get the best possible LocationRect based on information in the view as mentioned in the first response in this thead:

http://www.telerik.com/community/forums/wpf/map/how-to-get-best-possible-map-view-when-considering-all-poi-s.aspx

I attempted to use the second approach (the method posted at the end of the post), but it too is giving me some problems. I'm able to get a LocationRect, but I'm not able to call the SetView method to center/zoom the map appropriately.

I created properties in my view model for center and zoom. The MapCenter property seems to be working fine, but I'm having a hard time with the zoom property.

List<Telerik.Windows.Controls.Map.Location> locations = this.MyPushpins.Select(pin => pin.Location).ToList();
LocationRect rect = this.GetBestView(locations, new Size(0.01, 0.01));
 
MapCenter = rect.Center;
MapZoomLevel = rect.ZoomLevel;

The problem is the LocationRect.ZoomLevel property isn't set and I don't know how to set it without having more information from the map, itself.

For reference, here is the method posted in the original thread:

public LocationRect GetBestView(IEnumerable<PointOfInterest> itemsList, Size defaultSize)
{
    LocationRect bestView = new LocationRect();
    Location northEast = Location.Empty;
    Location southWest = Location.Empty;
   
    foreach (PointOfInterest item in itemsList)
    {
        Location location = item.Location;
   
        if (northEast.IsEmpty)
        {
            northEast = location;
        }
        else
        {
            if (!location.IsEmpty)
            {
                northEast.Latitude = Math.Max(northEast.Latitude, location.Latitude);
                northEast.Longitude = Math.Max(northEast.Longitude, location.Longitude);
            }
        }
   
        if (southWest.IsEmpty)
        {
            southWest = location;
        }
        else
        {
            if (!location.IsEmpty)
            {
                southWest.Latitude = Math.Min(southWest.Latitude, location.Latitude);
                southWest.Longitude = Math.Min(southWest.Longitude, location.Longitude);
            }
        }
    }
   
    if (!northEast.IsEmpty && !southWest.IsEmpty)
    {
        bestView = new LocationRect(northEast, southWest);
   
        if (bestView.IsEmpty)
        {
            bestView = new LocationRect(
                new Location(bestView.North + defaultSize.Height / 2.0, bestView.West - defaultSize.Width / 2.0),
                new Location(bestView.North - defaultSize.Height / 2.0, bestView.West + defaultSize.Width / 2.0));
        }
    }
   
    return bestView;
}
Andrey
Telerik team
 answered on 28 Nov 2011
4 answers
250 views
I'm trying to display polygons, polylines and ellipses on the map using a template selector.  The ellipse data template is defined to hotspot to center the ellipse at the MapLayer.Location, but this is getting ignored and the location is still applied to the top-left of the ellipse.

The only way I can get a HotSpot to work on an ellipse is to add the control directly to an information layer and not use a template.  Is there any reason the HotSpot shouldn't work in a templated item?

public class ViewModel
{
    public List<Location> Locations { get { return new List<Location>() {new Location(0, 0)}; } }
}

<Window x:Class="TelerikMapTest.MainWindow"
        xmlns:TelerikMapTest="clr-namespace:TelerikMapTest"
        Title="MainWindow" Height="350" Width="525">
     
    <Window.DataContext>
        <TelerikMapTest:ViewModel />
    </Window.DataContext>
     
    <Window.Resources>
        <DataTemplate x:Key="template">
            <telerik:MapEllipse Width="1000" Height="1000"
                        Fill="Blue" Opacity="0.6"
                        telerik:MapLayer.Location="{Binding}">
                <telerik:MapLayer.HotSpot>
                    <telerik:HotSpot X="0.5" Y="0.5"
                              XUnits="Fraction" YUnits="Fraction" />
                </telerik:MapLayer.HotSpot>
            </telerik:MapEllipse>
        </DataTemplate>   
    </Window.Resources>
     
    <Grid>
        <telerik:RadMap>
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider />
            </telerik:RadMap.Provider>
             
            <telerik:InformationLayer ItemsSource="{Binding Locations}"
                            ItemTemplate="{StaticResource template}" />
            <telerik:InformationLayer>
                <telerik:MapEllipse Width="1000" Height="1000"
                            Fill="Yellow" Opacity="0.6"
                            telerik:MapLayer.Location="0,0">
                    <telerik:MapLayer.HotSpot>
                        <telerik:HotSpot X="0.5" Y="0.5"
                                  XUnits="Fraction" YUnits="Fraction" />
                    </telerik:MapLayer.HotSpot>
                </telerik:MapEllipse>
            </telerik:InformationLayer>
        </telerik:RadMap>
    </Grid>
</Window>
Andrey
Telerik team
 answered on 28 Nov 2011
4 answers
166 views
Hi guys

I'm having a radgrid and a DateTime column

Nevertheless, i only want to display the date (without time)
<tcg:GridViewDataColumn DataMemberBinding="{Binding ITEM.Deliverydate}" DataFormatString="{}{0:dd/MM/yyyy}" Header="Delivery Date"  >
This also works fine so far, but when i comes to grouping this column it's not working.

Somehow it looks for me that the grouping in the background also uses the time, thats why i get different groups per item with always the same date.
This looks a little bit weired because the grouping text is always the same. If i have three entries with Deliverydate 20.11.2010 then the group looks like
20.11.2010    aggregate function: 1 item
20.11.2010    aggregate function: 1 item
20.11.2010    aggregate function: 1 item

correct would be
20.11.2010     aggregate function: 3 item

any suggestions?
thanks
Mohammad
Top achievements
Rank 1
 answered on 26 Nov 2011
0 answers
129 views
i am displaying two columns in the grid view and their visibilities (i.e. IsVisible Property) are controlled by corresponding check boxes. Also i have applied a count function in first column to show the total number of rows in the column footer
public partial class PlaybackView : UserControl, INotifyPropertyChanged
    {
  
        int _count = 0;
  
        public PlaybackView()
        {
            InitializeComponent();
        }
  
  
        #region Properties
  
        public DataTable PlaybackTable
        {
            get { return (DataTable)GetValue(PlaybackTableProperty); }
            set
            {
                SetValue(PlaybackTableProperty, value);
            }
  
        }
  
        // Using a DependencyProperty as the backing store for DataTable.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PlaybackTableProperty = DependencyProperty.Register("PlaybackTable", typeof(DataTable), typeof(PlaybackView));
  
        //private static void OnPresentableTableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    PlaybackView playbackView = d as PlaybackView;
  
        //    if (playbackView != null)
        //    {
  
        //        playbackView.PlaybackLogView = new ListCollectionView(playbackView.PlaybackTable.DefaultView);
        //    }
        //}
  
  
        public List<string> GroupBy
        {
            get { return (List<string>)GetValue(GroupByTextProperty); }
            set
            {
                SetValue(GroupByTextProperty, value);
  
            }
        }
  
        public static readonly DependencyProperty GroupByTextProperty = DependencyProperty.Register("GroupBy", typeof(List<string>), typeof(PlaybackView), new UIPropertyMetadata(null, OnGroupByPropertyChanged));
  
        private static void OnGroupByPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //PlaybackView playbackView = d as PlaybackView;
  
            //if (playbackView != null)
            //{
            //    playbackView.PlaybackLogView.GroupDescriptions.Add(new PropertyGroupDescription(playbackView.GroupBy));
                 
            //}
        }
  
        #endregion
  
  
  
        #region INotifyPropertyChanged Members
  
        public event PropertyChangedEventHandler PropertyChanged;
  
        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }
  
        #endregion
  
        private void telrikDataGrid_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
        {
            if (GroupBy.Count > 0)
            {
                if (_count > 0)
                {
                    this.telrikDataGrid.GroupDescriptors.Clear();
                }
  
                ColumnGroupDescriptor descriptor = new ColumnGroupDescriptor();
                descriptor.Column = this.telrikDataGrid.Columns[GroupBy[0]];
                this.telrikDataGrid.GroupDescriptors.Add(descriptor);
                ++_count;
  
            }
  
        }
  
    }
  
  
-------------------------------------------XAMl Code----------------------------------------------
  
 <Grid>
  
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
  
        <Button  Content="Load Data" HorizontalAlignment="Right" Click="Button_Click" />
        <CheckBox x:Name="_check" Grid.Row="1" Content="Visibility" IsChecked="True"/>
  
        <telerik:RadGridView  Grid.Row="2" x:Name="_telerikGrid" ShowColumnFooters="True"  AutoGenerateColumns="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Table}">
  
            <telerik:RadGridView.Columns>
  
  
                <telerik:GridViewDataColumn Header="PresentationName" DataMemberBinding="{Binding PresentationName}">
                </telerik:GridViewDataColumn>
  
                <telerik:GridViewDataColumn Header="LogLevel" DataMemberBinding="{Binding LogLevel}" IsVisible="{Binding ElementName=_check, Path=IsChecked}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="Total Rows"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
  
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
  
  
    </Grid>
. so first time when i run the application it showing all the columns successfully but if i do Isvisible property of first column to false and then load the gridview with new data it shows an error in the handler of the INotifyPropertyCanhged Interface.

And the error is: "Object reference not set to an instance of an object."


please help me out.,....
Vinod
Top achievements
Rank 1
 asked on 26 Nov 2011
0 answers
57 views
i am displaying two columns in the grid view and their visibilities (i.e. IsVisible Property) are controlled by corresponding check boxes. Also i have applied a count function in first column. so first time when i run the application it showing all the columns successfully but if i do Isvisible property of first column to false and then load the gridview with new data it shows an error in the handler of the INotifyPropertyCanhged Interface.

And the error is: "Object reference not set to an instance of an object."


please help me out.,....
public partial class PlaybackView : UserControl, INotifyPropertyChanged
    {
 
        int _count = 0;
 
        public PlaybackView()
        {
            InitializeComponent();
        }
 
 
        #region Properties
 
        public DataTable PlaybackTable
        {
            get { return (DataTable)GetValue(PlaybackTableProperty); }
            set
            {
                SetValue(PlaybackTableProperty, value);
            }
 
        }
 
        // Using a DependencyProperty as the backing store for DataTable.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PlaybackTableProperty = DependencyProperty.Register("PlaybackTable", typeof(DataTable), typeof(PlaybackView));
 
        //private static void OnPresentableTableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    PlaybackView playbackView = d as PlaybackView;
 
        //    if (playbackView != null)
        //    {
 
        //        playbackView.PlaybackLogView = new ListCollectionView(playbackView.PlaybackTable.DefaultView);
        //    }
        //}
 
 
        public List<string> GroupBy
        {
            get { return (List<string>)GetValue(GroupByTextProperty); }
            set
            {
                SetValue(GroupByTextProperty, value);
 
            }
        }
 
        public static readonly DependencyProperty GroupByTextProperty = DependencyProperty.Register("GroupBy", typeof(List<string>), typeof(PlaybackView), new UIPropertyMetadata(null, OnGroupByPropertyChanged));
 
        private static void OnGroupByPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //PlaybackView playbackView = d as PlaybackView;
 
            //if (playbackView != null)
            //{
            //    playbackView.PlaybackLogView.GroupDescriptions.Add(new PropertyGroupDescription(playbackView.GroupBy));
                
            //}
        }
 
        #endregion
 
 
 
        #region INotifyPropertyChanged Members
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }
 
        #endregion
 
        private void telrikDataGrid_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
        {
            if (GroupBy.Count > 0)
            {
                if (_count > 0)
                {
                    this.telrikDataGrid.GroupDescriptors.Clear();
                }
 
                ColumnGroupDescriptor descriptor = new ColumnGroupDescriptor();
                descriptor.Column = this.telrikDataGrid.Columns[GroupBy[0]];
                this.telrikDataGrid.GroupDescriptors.Add(descriptor);
                ++_count;
 
            }
 
        }
 
    }
 
 
-------------------------------------------XAMl Code----------------------------------------------
 
 <Grid>
 
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
        <Button  Content="Load Data" HorizontalAlignment="Right" Click="Button_Click" />
        <CheckBox x:Name="_check" Grid.Row="1" Content="Visibility" IsChecked="True"/>
 
        <telerik:RadGridView  Grid.Row="2" x:Name="_telerikGrid" ShowColumnFooters="True"  AutoGenerateColumns="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Table}">
 
            <telerik:RadGridView.Columns>
 
 
                <telerik:GridViewDataColumn Header="PresentationName" DataMemberBinding="{Binding PresentationName}">
                </telerik:GridViewDataColumn>
 
                <telerik:GridViewDataColumn Header="LogLevel" DataMemberBinding="{Binding LogLevel}" IsVisible="{Binding ElementName=_check, Path=IsChecked}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="Total Rows"/>
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
 
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 
 
    </Grid>
Vinod
Top achievements
Rank 1
 asked on 26 Nov 2011
1 answer
166 views
I'm new to the RadDateTimePicker and I'm wondering if the control can allow me to
round the SelectedValue to the minute (to effectively zero-out the seconds and milliseconds portion).

<telerik:RadDateTimePicker SelectedValue="{Binding TheVisitDateTime, Mode=TwoWay}"/>

I need it for calling a stored procedure with a SMALLDATETIME Parameter (which I'm not allowed to change).
So before I consider writing a ValueConverter for this, I need to know if the RadDateTimePicker control exposes a property for rounding to the minute ?

Right now the milliseconds is being passed to the stored procedure which is causing a conversion error.
(because the @dVisitDateTime is SMALLDATETIME data type).

exec schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime = '2011-11-22 15:47:10.25039', ...other params...
Msg 8114, Level 16, State 1, Procedure CompleteClientVisit, Line 0
Error converting data type varchar to smalldatetime.

My goal is to call the stored procedure such as below to avoid the conversion error.
exec schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime = '2011-11-22 15:47:00', ...other params...
Konstantina
Telerik team
 answered on 25 Nov 2011
4 answers
135 views
Hi,

I would like to customize the DayViewDefinition in behind code (VB). When my app start, the information will be get from the database. Now the only way I found to do it...is in XAML...
<Horaire:DayViewDefinition DayStartTime="06:00"
                          DayEndTime="23:00"    
                           MajorTickLength
="1h"    
                           MinorTickLength
="5min"    
                           TimerulerMinorTickStringFormat
=":{0:mm} "                                                                
                           TimerulerMajorTickStringFormat
="{}{0:HH}:{0:mm} "    
                           MinTimeRulerExtent
="4000"/>

Thanks for you help.

Patrick
Top achievements
Rank 2
 answered on 25 Nov 2011
0 answers
88 views
i have a grid view that contain rad combo box as column.
how can i bind rad combo box into wpf grid view from code behind using VB
vikas gupta
Top achievements
Rank 1
 asked on 25 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?