Telerik Forums
UI for WPF Forum
1 answer
145 views
Good evening,
I am implementing a drag and drop between two grids, which works fine and drags and drops great.
however, when I do the first drag and drop I get this error:
System.NullReferenceException occurred
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls
  StackTrace:
       at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.StartDragging() in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2_SP1\Sources\Development\Core\Controls\DragDrop\RadDragAndDropManager.cs:line 1083
  InnerException: 

The error occurs once and when I continue running the code the next drag and drops works great.
I am doing the drag and drops from a dialog window invoked from within the software.
I am using Q2 SP1 release.
Please help,
Eylon


Tsvyatko
Telerik team
 answered on 17 Jan 2011
2 answers
111 views
I have a [Add] button, clicking of which will call gridview.BeginInsert();
But with many pages, user has to go to the last page to enter  data for the new row to be inserted.

How can I do it from code-behind?

Thanks
gureumi
Top achievements
Rank 1
 answered on 17 Jan 2011
2 answers
85 views
Hi, I am trying to write a behavior for a radcarousel panel such that when the top most item gets a MouseEnter event a state is activated.  However, the TopContainer property always comes up as null.  Is this because the TopContainer property is not set at this point?  Below is the line of code I am running.

this.AssociatedObject.TopContainer.MouseEnter += new MouseEventHandler(TopContainer_MouseEnter);

Thanks,
Adam Burdette
Adam
Top achievements
Rank 1
 answered on 17 Jan 2011
11 answers
444 views
ok, my app have some usercontrols that contains Radgrid, Radtreewiew, Radmenu and other Telerik controls.

How do I easy set Theme for all controls, by code (so I can alow the user to chenge) or by XAML ?
Waleed Seada
Top achievements
Rank 2
 answered on 17 Jan 2011
3 answers
570 views
I am porting an existing WPF application to MVVM pattern and I am using the RadTreeView.  I am dynamically populating the Items collection at runtime of the RadTreeViewItem depending on whether a user has selected a Category node or a Object node. 

In a MVVM pattern, I am unsure of how to do this while preserving the state of the Treeview (selected, what is expanded).   So what would I do in the ViewModel and View to have this work?  Would I have to create a class that would emulate the Items collection? How do I preserve the state?

So I might have something like this:

Divisions
   --- AFC West (Category)
   --- AFC South (Category)
   ------ Colts (Object)
   ----------QBs (Category)
   -------------Peyton Manning  (Object)
   -------------Curtis Painter (Object)

   
Tina Stancheva
Telerik team
 answered on 17 Jan 2011
1 answer
328 views
Is there a way to cancel the selection of a RadComboBox?  The combobox selected item is bound to several other controls.  I was able to change the selected value and then change it back, but that has some other undesired effects.  I want to cancel the select before the selected item of the combo changes.
Valeri Hristov
Telerik team
 answered on 17 Jan 2011
1 answer
296 views
Hello,

Currently we're using a ListCollectionView to filter the items in the carousel. After I refresh the ListCollectionView I call BringDataitemIntoView(NameOfMyView.CurrentItem) with the carousel. But it isn't bringing the first item in the collection into view. I was wondering if you had any ideas on what I'm doing wrong? Below is a simple example of what I'm hitting.

Also I noticed if we type in 10, 11, 12, 13, or 14 it doesn't scroll anything into view.

I'm using versions 2010.3.1110.35 and 2010.1.603.35 (in an already released product)


<Window
    x:Class="CarouselTest2.MainWindow"
    xmlns:local="clr-namespace:CarouselTest2"
    Title="MainWindow" Height="350" Width="525">
     
    <Window.Resources>
         
        <DataTemplate DataType="{x:Type local:Item}">
            <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5">
                <Grid>
                    <Label Content="{Binding Path=Value}" />
                </Grid>
            </Border>
        </DataTemplate>
         
    </Window.Resources>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>       
         
        <TextBox x:Name="txtBox" Grid.Row="0" TextChanged="TextBox_TextChanged" />
         
        <telerik:RadCarousel
            x:Name="Carousel"
            Grid.Row="1"
            Focusable="False"
            AutoGenerateDataPresenters="False"
            HorizontalScrollBarVisibility="Hidden"
            VerticalScrollBarVisibility="Visible">
            <telerik:RadCarousel.ItemsPanel>
                <ItemsPanelTemplate>
                    <telerik:RadCarouselPanel
                        ItemsPerPage="7"
                        IsOpacityEnabled="False"
                        PathPadding="0">
                        <!--<telerik:RadCarouselPanel.Path>
                            <Path Stretch="Fill">
                                <Path.Data>
                                    <LineGeometry StartPoint="0, 800" EndPoint="0, 10" />
                                </Path.Data>
                            </Path>
                        </telerik:RadCarouselPanel.Path>-->
                    </telerik:RadCarouselPanel>
                </ItemsPanelTemplate>
            </telerik:RadCarousel.ItemsPanel>
        </telerik:RadCarousel>
 
    </Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
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.Navigation;
using System.Windows.Shapes;
using System.Collections;
 
namespace CarouselTest2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        ListCollectionView view;
 
        public MainWindow()
        {
            InitializeComponent();
 
 
            List<Item> Items = new List<Item>();
            for (int i = 0; i < 150; i++)
            {
                Items.Add(new Item(i));
            }
 
            view = new ListCollectionView(Items.ToList());
            view.Filter = new Predicate<object>(FilterObject);
            this.Carousel.ItemsSource = view;
        }
 
        private bool FilterObject(object itemToFilter)
        {
            if (itemToFilter == null)
                return false;
 
            String filterText = this.txtBox.Text.ToUpper();
             
            if (filterText.Length == 0)
                return true;
             
            return ((itemToFilter as Item).Value.ToString().Contains(filterText));
 
        }
 
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            this.view.Refresh();
            this.Carousel.BringDataItemIntoView(this.view.CurrentItem);
             
        }
    }
 
    public class Item
    {
        public Item(int i)
        {
            this.Value = i;
        }
 
        public int Value { get; set; }
    }
 
}

Thanks Much,
~Boots
Yordanka
Telerik team
 answered on 17 Jan 2011
1 answer
50 views
The following code works perfectly in version 1304 and previous builds

<telerik:GridViewDataColumn DataMemberBinding="{Binding Period}" Header="Period">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding PeriodFormatted}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                    <telerik:GridViewColumn.CellEditTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Path=PeriodFormatted, Mode=TwoWay}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>

where in the viewmodel Period is a simple DateTime property and PeriodFormatted is a specially formatted string representation of the Period.

public string PeriodFormatted
       {
           get { return Period.PeriodToString(); }
           set
           {
               Period = value.StringToPeriod(ContractHeader.Date);
               SendPropertyChanged("PeriodFormatted");
           }
       }

Up to v.1304 when adding a new row, the value supplied by the GridView to the textbox in the cell edit template is a string value, but in v1314 the value supplied to the textbox is a DateTime value. When editing an existing row, the value supplied to the textbox is a string value.

I have had to revert to version 1304, since this new behaviour has completely broken my entire application!

You guys also made a change a few versions ago to the behaviour of the Enter key in the GridView. The form has a button set to IsDefault=true. Up until a few versions ago (I can't remember exactly which), pressing Enter in the GridView would commit the edit and pressing Enter again would be consumed by the button on the form. In the latest versions, pressing Enter in the GridView is no longer consumed by the grid, but by the form button.

So instead of comitting the line details with Enter, the form re-loads the original data! I have worked around this simply by removing the IsDefault=true from the form button, but it now needs the user to select the button with the mouse.

Is there any way to get back to the previous behaviour?

I think your products are marvellous and I use a number of your controls extensively throughout my projects. However, it is VERY frustrating when you break behaviour from previous builds - and the readme does not clearly state what has broken.

Regards
Jeremy
Nedyalko Nikolov
Telerik team
 answered on 17 Jan 2011
1 answer
93 views
We followed the instructions on http://www.telerik.com/help/silverlight/raddocking-theming-toolwindow.html to customize the ToolWindow for a undocked/unpinned RadPane. Doing so in Blend the Design-View show's the customized ToolWindow as it should be, but starting the application somehow overrides the style and it disappears.

Question: Do we miss something?
Dani
Telerik team
 answered on 17 Jan 2011
4 answers
265 views

My code:

MainWindow.xaml

<Window x:Class="TestStyle.MainWindow"
        xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
        <telerik:RadButton Width="150" Content="Add new row" 
                    Command="telerikGrid:RadGridViewCommands.BeginInsert" 
                    CommandTarget="{Binding ElementName=RadGridView1}"  />
    </StackPanel>
    <telerikGrid:RadGridView 
                     SelectionMode="Single" 
                     AddingNewDataItem="RadGridView1_AddingNewDataItem"
                     x:Name="RadGridView1"  
                     AutoGenerateColumns="False">
            <telerikGrid:RadGridView.Columns>
                <telerikGrid:GridViewComboBoxColumn Header="Screen"  
                                        UniqueName="Screen"  
                                        x:Name="screen" 
                                        DataMemberBinding="{Binding IdGrid}" 
                                        DisplayMemberPath="Name" 
                                        SelectedValueMemberPath="IdListBox" >
                <telerikGrid:GridViewComboBoxColumn.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Name}" x:Name="textblockTooltip" Width="Auto" Padding="1,1,1,1"
                            <TextBlock.ToolTip
                            <ToolTip>   
                                    <ToolTip.Template
                                    <ControlTemplate TargetType="ToolTip"
                                      <Border CornerRadius="2,2,2,2" Width="100" Height="75" x:Name="borderTooltip" Background="Green" BorderBrush="#FF000000" Margin="2"
                                       <ContentPresenter Content="{Binding GridView}" Margin="2" /> 
                                      </Border
                                    </ControlTemplate
                                    </ToolTip.Template>  
                            </ToolTip
                            </TextBlock.ToolTip>
                            </TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </telerikGrid:GridViewComboBoxColumn.ItemTemplate>
            </telerikGrid:GridViewComboBoxColumn>
        </telerikGrid:RadGridView.Columns>
    </telerikGrid:RadGridView>
    </StackPanel>
</Window>

MainWindow.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
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.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
  
namespace TestStyle
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
  
        bool resolution = false;
  
        public bool Resolution
        {
            get { return resolution; }
            set { resolution = value; }
        }
  
        public MainWindow()
        {
            InitializeComponent();
  
            ICommand beginInsertCommand = RadGridViewCommands.BeginInsert;
  
            ObservableCollection<ItemGrid> collectionGrid = new ObservableCollection<ItemGrid>();
            RadGridView1.ItemsSource = collectionGrid;
  
            ObservableCollection<ItemListBox> collectionListBox = new ObservableCollection<ItemListBox>();
             
            Label l1 = new Label();
            l1.Content = "Label 1";
            Label l2 = new Label();
            l2.Content = "Label 2";
            Grid gr1 = new Grid();
            gr1.Children.Add(l1);
            Grid gr2 = new Grid();
            gr2.Children.Add(l2);
  
            collectionListBox.Add(new ItemListBox(1, "Name 1", gr1));
            collectionListBox.Add(new ItemListBox(2, "Name 2", gr2));
            screen.ItemsSource = collectionListBox;
        }
  
        private void RadGridView1_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
        {
            e.NewObject = new ItemGrid(0);
        }
    }
}

ItemGrid.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel;
  
namespace TestStyle
{
    class ItemGrid : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
  
        private int idGrid;
  
        public int IdGrid
        {
            get { return idGrid; }
            set { idGrid = value; NotifyPropertyChanged("IdGrid"); }
        }
  
        public ItemGrid(int id)
        {
            this.idGrid = id;
        }
  
        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
}

ItemListBox.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel;
  
namespace TestStyle 
{
    class ItemListBox : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
  
        int idListBox;
  
        public int IdListBox
        {
            get { return idListBox; }
            set { idListBox = value; NotifyPropertyChanged("IdListBox"); }
        }
  
        string name;
  
        public string Name
        {
            get { return name; }
            set { name = value; NotifyPropertyChanged("Name"); }
        }
  
        Grid gridView;
  
        public Grid GridView
        {
            get { return gridView; }
            set { gridView = value; NotifyPropertyChanged("GridView"); }
        }
  
        public ItemListBox(int idListBox, string name, Grid gridView)
        {
            this.idListBox = idListBox;
            this.gridView = gridView;
            this.name = name;
        }
  
        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
}

I need to change Height property at Border "borderTooltip" according to value of property Resolution in ManWindow.xaml.cs.

I tried in constructor MainWindow() this:

if (Resolution == true)
    borderTooltip.Height = 75;
else 
    borderTooltip.Height = 50;

But i can´t access borderTooltip in code.Does somebody know please how to change borderTooltip.Height according to value of Resolution property?

Pavel
Top achievements
Rank 1
 answered on 14 Jan 2011
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?