Telerik Forums
UI for WPF Forum
5 answers
498 views
Hi

I have been using the property grid and I like it a lot, but now i have problem. Is there a way to add "properties" at runtime?

I have been trying to get a datatable/datarow to work with the property grid with no luck.

Any ideas?

Axel
Mauricio
Top achievements
Rank 1
 answered on 29 Apr 2012
1 answer
170 views
I am plotting about 500 items on the map and everything works fine until I zoom in or out. When this happens the CPU goes to 100% for 10 or so seconds and then things work again until the next zoom.

I used ANTS and found that all the slowness is from the method Telerik.Windows.Controls.Map.FileCacheBase.SaveFilesThread().

I also noticed this xaml error which is not from me:

System.Windows.Data Error: 25 : Both 'ContentTemplate' and 'ContentTemplateSelector' are set; 'ContentTemplateSelector' will be ignored. ContentPresenter:'ContentPresenter' (Name='')


Datafyer
Top achievements
Rank 1
Veteran
 answered on 28 Apr 2012
4 answers
145 views

Why PropertyGrid generate excess properties, when AutoGeneratePropertyDefinitions is set to false?

<Window x:Class="PropertyGridTester.MainWindow"
        xmlns:PropertyGridTester="clr-namespace:PropertyGridTester"
        Title="MainWindow" Height="350" Width="525"
        mc:Ignorable="d" 
        d:DataContext="{d:DesignInstance {x:Type PropertyGridTester:MainWindowViewModel}}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
          
        <StackPanel Grid.Column="0">
            <RadioButton Command="{Binding SetFirstClass}">Set first class</RadioButton>
            <RadioButton Command="{Binding SetSecondClass}">Set second class</RadioButton>
            <RadioButton Command="{Binding SetNull}" IsChecked="True">Set null</RadioButton>
        </StackPanel>
  
        <ContentControl Grid.Column="1" DataContext="{Binding SelectedClass}" Content="{Binding}">
            <ContentControl.Resources>
                <DataTemplate DataType="{x:Type PropertyGridTester:FirstClass}">
                    <telerik:RadPropertyGrid Item="{Binding}" AutoGeneratePropertyDefinitions="False" HorizontalAlignment="Stretch" SearchBoxVisibility="Collapsed"
                        SortAndGroupButtonsVisibility="Collapsed" DescriptionPanelVisibility="Collapsed" HorizontalContentAlignment="Stretch" LabelColumnWidth="110">
                        <telerik:RadPropertyGrid.PropertyDefinitions>
                            <telerik:PropertyDefinition Binding="{Binding Visible}" DisplayName="First class visible">
                                <telerik:PropertyDefinition.EditorTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Visible}" />
                                    </DataTemplate>
                                </telerik:PropertyDefinition.EditorTemplate>
                            </telerik:PropertyDefinition>
                        </telerik:RadPropertyGrid.PropertyDefinitions>
                    </telerik:RadPropertyGrid>
                </DataTemplate>
                <DataTemplate DataType="{x:Type PropertyGridTester:SecondClass}">
                    <telerik:RadPropertyGrid Item="{Binding}" AutoGeneratePropertyDefinitions="False" HorizontalAlignment="Stretch" SearchBoxVisibility="Collapsed"
                        SortAndGroupButtonsVisibility="Collapsed" DescriptionPanelVisibility="Collapsed" HorizontalContentAlignment="Stretch" LabelColumnWidth="110">
                        <telerik:RadPropertyGrid.PropertyDefinitions>
                            <telerik:PropertyDefinition Binding="{Binding Visible}" DisplayName="Second class visible">
                                <telerik:PropertyDefinition.EditorTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Visible}" />
                                    </DataTemplate>
                                </telerik:PropertyDefinition.EditorTemplate>
                            </telerik:PropertyDefinition>
                        </telerik:RadPropertyGrid.PropertyDefinitions>
                    </telerik:RadPropertyGrid>
                </DataTemplate>
            </ContentControl.Resources>
        </ContentControl>
  
    </Grid>
</Window>

using System;
using System.Windows.Input;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.ViewModel;
  
namespace PropertyGridTester
{
    public abstract class BaseClass : NotificationObject
    {
        private string _Visible = String.Empty;
  
        public string Visible
        {
            get { return _Visible; }
            set
            {
                if (_Visible == value)
                    return;
                _Visible = value;
                RaisePropertyChanged(() => Visible);
            }
        }
  
        private string _NotVisible = String.Empty;
  
        public string NotVisible
        {
            get { return _NotVisible; }
            set
            {
                if (_NotVisible == value)
                    return;
                _NotVisible = value;
                RaisePropertyChanged(() => NotVisible);
            }
        }
  
    }
  
    public class FirstClass : BaseClass
    {
    }
  
    public class SecondClass : BaseClass
    {
    }
  
    public class MainWindowViewModel : NotificationObject
    {
        public MainWindowViewModel()
        {
            SetFirstClass = new DelegateCommand(() => SelectedClass = new FirstClass());
            SetSecondClass = new DelegateCommand(() => SelectedClass = new SecondClass());
            SetNull = new DelegateCommand(() => SelectedClass = null);
        }
  
        public ICommand SetFirstClass { get; private set; }
  
        public ICommand SetSecondClass { get; private set; }
  
        public ICommand SetNull { get; private set; }
  
        private BaseClass _SelectedClass = null;
  
        public BaseClass SelectedClass
        {
            get { return _SelectedClass; }
            set
            {
                if (_SelectedClass == value)
                    return;
                _SelectedClass = value;
                RaisePropertyChanged(() => SelectedClass);
            }
        }
    }
}

Maxim
Top achievements
Rank 1
 answered on 28 Apr 2012
1 answer
135 views
Hi,

Using version 2012.1.326.40 of the DataVisualization control, the ToolTip is not displayed when the RadTimeline is inside a Popup. Mouse hovering over individual items works. Any ideas?

The code below illustrates my symptoms.

<Window x:Class="WpfApplication3.MainWindow"
        xmlns:example="clr-namespace:WpfApplication3"
        Title="MainWindow" Height="350" Width="525">
    <Window.DataContext>
        <example:ExampleViewModel />
    </Window.DataContext>
    <Grid>
         
        <Popup IsOpen="True" Width="800" Height="300">
        <telerik:RadTimeline Grid.Row="0"
                                 PeriodStart="{Binding StartDate, Mode=TwoWay}"
                                 PeriodEnd="{Binding EndDate, Mode=TwoWay}"
                                 VisiblePeriodStart="{Binding VisibleStartDate, Mode=TwoWay}"
                                 VisiblePeriodEnd="{Binding VisibleEndDate, Mode=TwoWay}"
                                 StartPath="StartDate"
                                 DurationPath="Duration"
                                 ToolTipPath="Details"
                                 ItemsSource="{Binding Data}">
            <telerik:RadTimeline.Intervals>
                <telerik:DayInterval />
                <telerik:YearInterval IntervalSpans="1,5" />
                <telerik:MonthInterval IntervalSpans="1,6" />
            </telerik:RadTimeline.Intervals>
        </telerik:RadTimeline>
 
        </Popup>
    </Grid>
</Window>
 
Marc-Andre
Top achievements
Rank 1
 answered on 27 Apr 2012
2 answers
99 views
Are there any basic projects that show how to generate the docking panes in code behind? All current demo samples are XAML file based. Thanks in advance for any info.
Matt
Top achievements
Rank 2
 answered on 27 Apr 2012
1 answer
239 views
I'm using a tileview to show a list of images with the ability to reorder and delete images as needed.  The image of what it looks like is attached.

Currently, when I delete an image (which I do by removing an item from the collection) it sets the viewer all the way back to the left and there is no way to programmatically(c#) scroll back to the right where the image was deleted from.

So what I need to understand is how do I set the scroll position of the radtileview?

Here's my view code.
                   
<telerik:RadTileView x:Name="ListView1" MaxRows="1" MaximizeMode="Zero" ScrollBarVisibility="Visible" ColumnWidth="Auto" Height="210"
    TileDragEnded="RadTileView1_TileDragEnded" ItemContainerStyle="{DynamicResource RadTileViewItemStyle}"
    HorizontalContentAlignment="Left"
    SelectionChanged="ListView1_SelectionChanged"  IsItemDraggingEnabled="True"
    IsSelectionEnabled="True"  IsAutoScrollingEnabled="True">                       
    <telerik:RadTileView.ContentTemplate   >                           
        <DataTemplate   >
            <Grid Margin="10,0,10,0" HorizontalAlignment="Left"    >                          
                 <Border  BorderThickness="1" Margin="-2" Background="Transparent" BorderBrush="Black" HorizontalAlignment="Left" VerticalAlignment="Top" >
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect>
                    </Border.Effect>
                    <Image  Height="Auto" Width="Auto"  VerticalAlignment="Top"    Source="{Binding ThumbnailImageControl}"  />
                </Border>
            </Grid>
        </DataTemplate>
         
    </telerik:RadTileView.ContentTemplate>
</telerik:RadTileView>


Here's the style referenced:
<Style x:Key="RadTileViewItemStyle" TargetType="{x:Type telerik:RadTileViewItem}"  >
    <Setter Property="Template" >
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:RadTileViewItem}" >
                <Border x:Name="GripBarElement" Background="Transparent" Width="Auto"  HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Grid Margin="5"   HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <ContentPresenter x:Name="ContentElement" MouseDown="img_MouseDown"
                                            Grid.Row="1" Width="Auto" HorizontalAlignment="Left" VerticalAlignment="Top"
                                            Content="{TemplateBinding Content}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"  />
                        <Grid x:Name="ContentCacheHost" Grid.Row="0" Width="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <Grid MinHeight="23"  Grid.Row="0">
                            <Button Content="X" Height="23" Margin="0,0,0,0"
                                Width="23" Click="btnDelete_Click"
                                Name="btnDelete"
                                Tag="{Binding FilePath}"  MouseEnter="btnDelete_MouseEnter" MouseLeave="btnDelete_MouseLeave"
                                Foreground="White"  FontSize="14" FontWeight="Bold" Opacity=".4"
                                VerticalAlignment="Top" HorizontalAlignment="Left" >
                                <Button.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#00AF69" Offset="0" />
                                        <GradientStop Color="#138D5D" Offset="1" />
                                    </LinearGradientBrush>
                                </Button.Background>
                            </Button>
                        </Grid>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Here's how I bind:
public ObservableCollection<StaticObjects.BmpImage> BitmapImageList { get; set; }

ListView1.ItemsSource = BitmapImageList;

I thought this would work but no luck            
if (currentselectedindex > 0)
{
    ListView1.SelectedIndex = currentselectedindex - 1;
    ListView1.BringIntoView(ListView1.Items[currentselectedindex]);
}

Here's another clue in the delete any ideas?
    void btnDelete_Click(object sender, RoutedEventArgs e)
    {
        Button btn = (Button)sender;
        string filepath = btn.Tag.ToString();
 
        StaticObjects.BmpImage bmp = BitmapImageList.Where(p => p.FilePath == btn.Tag).SingleOrDefault();
 
        int currentidex = ListView1.Items.IndexOf(bmp);
 
        bmp.Dispose();
        BitmapImageList.Remove(bmp);
}
Zarko
Telerik team
 answered on 27 Apr 2012
29 answers
554 views
It looks like your demos all have a handful of points...do you support x-y graphs with thousands of points, like scientific data?
Giuseppe
Telerik team
 answered on 27 Apr 2012
2 answers
158 views
Hi,

I'm trying to follow this example: http://www.telerik.com/help/wpf/radtreeview-how-to-iterate-through-treeviewitems.html .Apparently it allows me to iterate through a RadTreeView.


However, I get the following error:
Error 8 The type or namespace name 'ItemsControl' does not exist in the namespace 'Telerik.Windows.Controls' (are you missing an assembly reference?) 
Robert
Top achievements
Rank 1
 answered on 27 Apr 2012
3 answers
181 views
Hi,
I do manage to execute a number of action with UI Automation against a radGridView such as:
 - Creating a new row
- Reading the content of a cell
But I really don't understand how one could write in a cell. Using Snoop, I can see that before you select a cell, its underlying control is a TextBlock and only when you click on the cell, you get a TextBox. Which automation patterns do you use to click on a given cell?
My goal is to simulate a click on the cell, the get access to the underlying TextBox in order to change its content.
Please let me know if this can be done.

Thank you in advance,
Hassan
Ivan Ivanov
Telerik team
 answered on 27 Apr 2012
3 answers
156 views
Hi,

I would like to know where I can get the localization key for the OutlookBar control? When my control is collapsed. The "Folders" string appear on my control and I want to translate it.

Thank's
Petar Mladenov
Telerik team
 answered on 27 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?