Telerik Forums
UI for WPF Forum
4 answers
270 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
174 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
131 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
59 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
171 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
138 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
91 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
2 answers
108 views
We have a problem with the RadGridView, when we have at our top level a collection full of "GroupDto"'s..
Below this we have "GroupMemberDto" Items...

so in our list we potentially have for example...

- GroupDto 1
          - GroupMemberDto 1
          - GroupMemberDto 2
+ GroupDto 2
- GroupDto 2
          - GroupMemberDto 3
          - GroupMemberDto 4
          - GroupMemberDto 5
          - GroupMemberDto 6
- GroupDto 4


So the problem occurs, when we have a top level item selected say "GroupDto1" and "GroupMemberDto1" selected....

then the problem occurs if we try to sort by one of the fields on GroupMemberDto... we get the following error
"Unable to cast object of type 'BusinessPort.Agility.Core.Shared.DataTransferObjects.GroupMemberDto' to type 'BusinessPort.Agility.Core.Shared.DataTransferObjects.GroupDto'."

a copy of the call stack we get is...

Telerik.Windows.Data.dll!Telerik.Windows.Data.FuncExtensions.ToUntypedFunc<BusinessPort.Agility.Core.Shared.DataTransferObjects.GroupDto,string>.AnonymousMethod__0(object item) Line 24 + 0x34 bytes   C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.FunctionComparer.Compare(object x, object y) Line 34 + 0x1c bytes C#
[External Code]
Telerik.Windows.Data.dll!Telerik.Windows.Data.KeyedCollection.IndexOf(object value) Line 224 + 0x1e bytes   C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(object item) Line 1745 + 0x1a bytes   C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.IndexOf(object item) Line 1735 + 0xc bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.IndexOf(object value) Line 386 + 0x19 bytes    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollIntoViewRecursive(System.Windows.FrameworkElement element, System.Collections.Generic.Stack<object> itemStack, System.Action<System.Windows.FrameworkElement> scrollFinishedCallback, System.Action scrollFailedCallback) Line 309 + 0x19 bytes   C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollRowIntoViewInternal(object dataItem, System.Action<System.Windows.FrameworkElement> scrollFinishedCallback, System.Action scrollFailedCallback) Line 254  C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollIntoViewAsync.AnonymousMethod__57() Line 95 + 0x2a bytes  C#
[External Code]

And some further details...

 
Locating source for 'c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs'. Checksum: MD5 {b7 2f 2f f ce 2e 64 af 4c 3d 12 d7 27 d7 88 35}
The file 'c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs' does not exist.
Looking in script documents for 'c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs'...
Looking in the projects for 'c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs.
The debugger could not locate the source file 'c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs'.

Hope this all makes sense, Let me know if you have any suggestions on how we can solve this, or if you require further information?

Vlad
Telerik team
 answered on 25 Nov 2011
2 answers
75 views
Hi,
  When I group a GridViewCheckBoxColumn. the gridview show groupdescriptor as "true" or "false", i want show "Yes" and "No". How can i change that title?

Thanks
Gerardo
Top achievements
Rank 1
 answered on 25 Nov 2011
1 answer
138 views
Hello,

I have some controls which contains each a raddocking.
I navigate to each other, then i save docking states on unload controls and reload layout on load controls.

When i save, floatting panel, after the relaoding, the window (toolwindow that contains pane) is no more topmost.

(the only pane that works as excpected is the one this is in a RadSplitContainer  where InitialPosition is "FloatingOnly".

Aurore
George
Telerik team
 answered on 25 Nov 2011
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?