Telerik Forums
UI for WPF Forum
3 answers
266 views
I'm using the RadCalendar in Month selection mode (DateSelectionMode="Month"). I want the control to default to the current month and for this month to be visibly selected by default as well.

When I default the SelectedDate and/or DisplayDate properties to the current date the current month is still not visibly selected.

The only way I can get this to work is via a hack like:
Loaded += (s, e) =>
{
  var today = DateTime.Today;
  calendar.SelectedDate = new DateTime(today.Year, today.Month, 2);
  calendar.SelectedDate = new DateTime(today.Year, today.Month, 1);
};

Is this a bug? Is there a better way to default to the current month?

Kaloyan
Telerik team
 answered on 27 Aug 2010
3 answers
326 views
Hi everyone, I'm newbie when it comes to WPF so i have some - maybe too basic question, but still. 
I have a question on how to populate specific columns in radgrid view with columns in List that i got from my orm model.

For example - this is my code behind to set datacontext of a grid view P.S. I would like to put that into resources:
public partial class MyClass : Page
    {
        public List<MyTable> myList { get; set; }
  
        public Drzava()
        {
            using (MyModel dbContext = new MyModel())
            {
                myList = dbContext.MyTable.ToList();
  
            }
            InitializeComponent();
              
            myGridView.DataContext = myList;
        }
    }

if I set ItemsSource="{Binding ElementName=myPage,Path=myList}" , i get populated all the columns, but i only want specific ones...so i tried somethink like that:
<telerik:RadGridView Name="myGridView" Margin="12,65,12,12" ItemsSource="{Binding ElementName=myPage,Path=myList}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewColumn DataContext="{Binding Path=Id}"></telerik:GridViewColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
But I cannot get it to work...
Thank you in advance for the reply and help.
Yavor Georgiev
Telerik team
 answered on 27 Aug 2010
3 answers
145 views
Hi!

I've to create a tree that represent Files and Folder.

my actual structure is:

Folder object has
-->SubFolder ObservableCollection
-->File List (observablecollection too)

I need to have in the same tree files and folder.

I've no problem creating a treee browsing Folders:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.Resources>
        <HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding SubFolders}">
            <TextBlock Text="{Binding Name}"/>
        </HierarchicalDataTemplate>
    </Grid.Resources>
    <telerik:RadTreeView Name="uxRadTreeView" ItemsSource="{Binding RootFolder.SubFolders}" ItemTemplate="{StaticResource NodeTemplate}" AllowDrop="False" IsDragDropEnabled="True" DragEnded="uxRadTreeView_DragEnded" />
</Grid>

But how can I get files with that too?

They both have a "Name" property


Hristo
Telerik team
 answered on 27 Aug 2010
1 answer
150 views

Hey there!

I get insert, delete and Edit to work

But when i insert one row, delete gets disabled and insert row aswell.

<Window x:Class="Administration.Window1"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignWidth="833" SizeToContent="WidthAndHeight" d:DesignHeight="567">
 
 
    <Grid Height="528" Width="815">
             
        <Border telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" Margin="0,81,-2,15" />
 
        <StackPanel Orientation="Horizontal" Margin="102,0,98,456" Height="22.301" VerticalAlignment="Bottom" HorizontalAlignment="Center">
            <telerik:RadButton Width="150" Content="Delete selected rows" Margin="0,0,5,0"
                               Command="telerikGrid:RadGridViewCommands.Delete" CommandTarget="{Binding ElementName=RadGridView1}" VerticalAlignment="Top" />
            <telerik:RadButton Width="150" Content="Add new row" Margin="0,0,5,0"
                               Command="telerikGrid:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=RadGridView1}" VerticalAlignment="Top" />
            <telerik:RadButton Width="150" Content="Save insert/edit" Margin="0,0,5,0"
                               Command="telerikGrid:RadGridViewCommands.CommitEdit" CommandTarget="{Binding ElementName=RadGridView1}" Height="Auto" VerticalContentAlignment="Center" VerticalAlignment="Top" />
            <telerik:RadButton Width="150" Content="Cancel insert/edit"
                               Command="telerikGrid:RadGridViewCommands.CancelRowEdit" CommandTarget="{Binding ElementName=RadGridView1}" VerticalAlignment="Top" />
        </StackPanel>
 
 
        <telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding}"
                             CanUserInsertRows="True"
                             CanUserDeleteRows="True"
                             ActionOnLostFocus="CommitEdit"
                             RowEditEnded="PricingGrid_RowEditEnded" Margin="0,81,0,0"  >
            <telerik:RadGridView.RowStyle>
                    <Style TargetType="telerik:GridViewRow">
                        <Setter Property="MinHeight" Value="40" />
                    </Style>
                </telerik:RadGridView.RowStyle>
                <telerik:RadGridView.Columns>
 
                <telerik:GridViewColumn>
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadButton Content="Delete" Command="telerikGrid:RadGridViewCommands.Delete" CommandParameter="{Binding}" />
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                     
                     
                     
                    <telerik:GridViewToggleRowDetailsColumn />
                     
              </telerik:RadGridView.Columns>
                <telerik:RadGridView.RowDetailsTemplate>
                    <DataTemplate>
                        <telerik:RadTabControl BackgroundVisibility="Collapsed" x:Name="RadTabControl1" Margin="10" VerticalAlignment="Center" Background="Transparent">
                            <telerik:RadTabItem Header="Description" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Foreground="Black">
                                <Grid Width="Auto" HorizontalAlignment="Stretch">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition Height="15" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    
                                    <TextBlock Text="Description: " Margin="5,10,0,0" FontWeight="Bold" Grid.Row="0" Grid.Column="1" />
                                    <TextBlock Text="{Binding strDescription}" Margin="5,10,0,0" Grid.Row="0" Grid.Column="2" />
                                    <!--<TextBlock Text="Country: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="1" Grid.Column="1" />
                                    <TextBlock Text="{Binding nCountry}" Margin="5,0,0,0" Grid.Row="1" Grid.Column="2" />-->
                                    
                                     
                                </Grid>
                            </telerik:RadTabItem>
                        </telerik:RadTabControl>
                    </DataTemplate>
                </telerik:RadGridView.RowDetailsTemplate>
            </telerik:RadGridView>
        
        <StackPanel Height="46.14" Margin="0" Name="stackPanel1" VerticalAlignment="Top" Orientation="Horizontal" HorizontalAlignment="Center">
            <telerik:RadButton  Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 Artiklar
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 
                Priser
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 ETC
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 ETC
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 OSV
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                OSV
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                 Artiklar
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
               Priser
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" HorizontalAlignment="Center">
                OSV
            </telerik:RadButton>
            <telerik:RadButton Height="45.371" Width="61.52" ClickMode="Release" ClipToBounds="False" HorizontalAlignment="Center">
                 ETC
            </telerik:RadButton>
        </StackPanel>
    </Grid>
</Window>
 
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Telerik.Windows.Data;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Collections;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using System.Linq;
using System.Globalization;
using Telerik.Windows.Controls.Charting;
 
namespace Administration
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public CollectionViewSource Source { get; set; }
 
        public List<Categories> _EditedCategories;
 
        public Window1()
        {
            InitializeComponent();
            this.Source = new CollectionViewSource();
            _EditedCategories = new List<Categories>();
 
            BindData();
        }
 
        private void BindData()
        {
            var wcomPosDB = new WcomPosProductDataContext();
 
            //var getCats = (from u in wcomPosDB.tblCategories
            //               join c in wcomPosDB.tblCategoryDescriptions on u.nID equals c.nCategoryID
            //               select new { ID = u.nID, Description = u.strDescription, Country = c.nCountry }).ToList();
 
            var testCats = from u in wcomPosDB.tblCategories
                           select u;
 
            //select new { ID = u.nID, Description = u.strDescription }).ToList();
 
 
            var list = new ObservableCollection<Categories>();
 
            foreach (var cat in testCats)
            {
                list.Add(new Categories { nID = cat.nID, strDescription = cat.strDescription });
            }
 
            Source.Source = list;
 
            this.DataContext = Source.View;
 
        }
 
 
 
        private void PricingGrid_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e)
        {
            if (e.EditOperationType == Telerik.Windows.Controls.GridView.GridViewEditOperationType.Insert)
            {
                this.DataContext = Source.View.OfType<Categories>().OrderBy(c => c.nID);
 
                Source.Source = this.DataContext;
 
                RadGridView1.SelectedItem = e.NewData;
                RadGridView1.ScrollIntoView(e.NewData);
 
            }
 
 
            //add edited item to new list, then use this list to update the database..
            if (e.NewData != null)
            {
                _EditedCategories.Add((Categories)e.NewData);
            }
 
             
        }
 
        public class FuncValueConverter : IValueConverter
        {
            private readonly Func<object, object, object> convertFunc;
 
            public FuncValueConverter(Func<object, object, object> convertFunc)
            {
                this.convertFunc = convertFunc;
            }
 
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                return this.convertFunc(value, parameter);
            }
 
            public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
 
 
 
        public class Categories
        {
            public long nID { get; set; }
            public string strDescription { get; set; }
        }
       
    }
}
 
 
Im new to Telerik, and this been bugging me for a while now.
 
Hope someone out there can help me.
 
Regards Joachim.
Nedyalko Nikolov
Telerik team
 answered on 27 Aug 2010
1 answer
141 views
Hi,
   Do you have any example for Half Circle Gauges with Numeric Indicator?
   I can't find one. 
   When tried to do it myself, the digits overrides the arrow indicator. It doesn't look nice.
   Any examples? Any ideas?

Guy.
Andrey
Telerik team
 answered on 27 Aug 2010
2 answers
144 views
Hello,

I have a RadGridView with six columns defined and where the first column is a checkbox. When inserting a new row in this grid the checkbox is checked and one set of column are mandatory to set values. The user can uncheck this checkbox which results in a different set of columns are mandatory to set values. However the cell validation is not updated in the GUI until I leave the tabcontrol och returns to it.

Any ideas how to solve this?

Best regards / Anna

Rudis
Top achievements
Rank 1
 answered on 27 Aug 2010
1 answer
90 views
Hello, 
 
 I have a telerik grid(Grid A) which is binding with the Observablecollection<parentbusinessobject>. and it contains a rowdetails template of another telerik grid(Grid B). Also inner grid(Grid B) is binding to the Observablecollection<childbusinessobject>.

I have added a button as cell template in the inner grid row (Grid B) as user click the button will add the particular item in to the shopping basket.  

It is working fine with mouse click event and I want to reach the same functionality using the keyboard events (F4) as well. 

Thanking You
 
Milan
Telerik team
 answered on 27 Aug 2010
2 answers
69 views
Hello,

I have a radgridview with a gridviewcombobox column which is bound to a collection. So all the rows in that particular column will show the entries in the collection. In the first row of that column, I want to filter the collection. i.e for the first row i want to display only 'yes' in the combobox were as in the rest of the rows I want to display 'yes','no','none'. Is there any way to filter only certain rows in a bound gridviewcombobox column.

Please help.


Thanks in Advance,
Norbert John
Norbert John
Top achievements
Rank 1
 answered on 27 Aug 2010
4 answers
283 views
Hello All,

I am sure this was answered already, but I cannot seem to find it using any of my searches.

We have a RadGridView with quite a bit of data.  We are filtering on a column, but all of the unique values in that column do not show up in the filter list to select them.  The list seems to just stop and not display anything else after a certain point.

Is there a limitation on the number of items that appear in this list?  If so, what is the count and how can we turn off this list if the count is greater than the max.  (using a style preferably).

We are using Q1 2010 SP2 of the controls.

Thanks in advance,
Chris
Chris Andrews
Top achievements
Rank 1
 answered on 26 Aug 2010
1 answer
68 views
Hi there!

I'm searching for a way to make a treeView with two types os objects:

A. 
  |_ D.
  |     |_F.
  |     |_3
  |_ E.
  |_ 1
  |_ 2
B.
C.

Character are Files Type (Keys), and numbers as objects (Values)
I can't find a way to mix up the two types in the same Hineritance.
If someone have a solution? Please tell me.

Best Regards

Valerio
Miroslav
Telerik team
 answered on 26 Aug 2010
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?