Telerik Forums
UI for WPF Forum
1 answer
63 views
Hi.
I am looking for "the right way" to add new Rows to a GridView...
1. Is there any pre-defined method to add new rows ? (Like the WinForms MS-Grid used to have...)
Something like:
AddNewRowIfUserDoubleClicksTheLeftPane="true" 

2. I am displaying some navigateable Properties which are based on Types of which I know the Interface only..
Something Like:
public class DisplayData  
{  
   public string Name { getset; }  
   public ISomeInterfaceType Prop { getset; }  
}  
  
public interface ISomeInterfaceType  
{  
   string OtherName { get; }  
}  
<telerik:GridViewDataColumn     
     Header="Name"    
     DataMemberBinding="{Binding Path=Name, Mode=OneWay}"    
     Width="2*"    
     IsReadOnly="True"/>    
<telerik:GridViewDataColumn     
     Header="Other"    
     DataMemberBinding="{Binding Path=Prop.OtherName, Mode=OneWay}"  
     DataType="{x:Type sys:String}"  
     Width="3*"    
     IsReadOnly="True"/>
However, I want to be able to let the user add new rows - in which case I need two entered strings (which I check for validity) and afterwards return the new "DisplayData"-Object. Currently I am doing this using a new Window (ShowDialog()) which let's the User input his data...

Can I use the "new-row" feature of the GridView, if some columns are bound to read-only properties or even classes of which I know only the Interface ?

Yours,
Nils


Nedyalko Nikolov
Telerik team
 answered on 14 Aug 2009
1 answer
166 views
I am unable to view the cs code - clicking the tab leaves the xaml.
Valeri Hristov
Telerik team
 answered on 14 Aug 2009
1 answer
412 views
I can't seem to get TwoWay Binding to work with the TabControl SelectedIndex Property,  anybody else get this to work or is it just broken?
XAML Looks like this:
<Controls1:RadTabControl DockPanel.Dock="Top" SelectedIndex="{Binding Path=Header.SelectedTabIndex,Mode=TwoWay}" >
ViewModel Looks like this:
        public int SelectedTabIndex
        {
            get { return _selectedTabIndex; }
            set
            {
                if (_selectedTabIndex != value)
                {
                    _selectedTabIndex = value;
                    RaisePropertyChanged("SelectedTabIndex");
                }
            }
        }
Now, it gets updated if the user clicks a tab, but if its set in the ViewModel, TabControl does nothing...







Using 2009.2.701.35 build
Bobi
Telerik team
 answered on 13 Aug 2009
8 answers
173 views
I am really confused with how to DataBind. I have 2 nearly identical projects, one using LINQ, the other OpenAccess, using only the Categories table from the Northwind database. Basically, a grid (of that table), and 2 textboxes for editing / 2-way binding.

Here is the code for Window1.xaml (LINQ Project):
<Window x:Class="NWLinq.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:NWLinq" 
    Title="Northwind LINQ" Height="400" Width="575" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    <Window.Resources> 
        <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}"  /> 
    </Window.Resources> 
 
    <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="200*" /> 
            <ColumnDefinition Width="300*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="240*" /> 
        </Grid.RowDefinitions> 
        <my:RadGridView  
            Grid.Row="2"  
            Name="radGridView1"  
            Grid.ColumnSpan="2"  
            ColumnsWidthMode="Fill" 
            IsReadOnly="False"  
            SelectedItem="{Binding SelectedItem}" 
            ItemsSource="{Binding CategoryList}"              
        > 
        </my:RadGridView> 
        <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}"  /> 
        <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}"  /> 
    </Grid> 
</Window> 
 

and from the OA project:
<Window x:Class="NWOA.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"     
    xmlns:local="clr-namespace:NWOA" 
    Title="Northwind OpenAccess" Height="400" Width="575" > 
    <Window.Resources> 
        <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}"  /> 
    </Window.Resources> 
 
    <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="200*" /> 
            <ColumnDefinition Width="300*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="240*" /> 
        </Grid.RowDefinitions> 
        <my:RadGridView  
            Grid.Row="2"  
            Name="radGridView1"  
            Grid.ColumnSpan="2"  
            ColumnsWidthMode="Fill" 
            IsReadOnly="False"  
            SelectedItem="{Binding SelectedItem}" 
            ItemsSource="{Binding CategoryList}"              
        > 
        </my:RadGridView> 
        <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}"  /> 
        <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}"  /> 
    </Grid> 
</Window> 
 

They should be identical (other than x:Class=...)

The Window1.xaml.cs files are the same (except for the namespace:
using System.Windows; 
 
namespace NWLinq 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
        } 
    } 
------- 
 
using System.Windows; 
 
namespace NWOA 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
        } 
    } 
 

The viewmodels are as close as can be, based on different requirements for LINQ and OA:
using System.Collections.Generic; 
using System.Linq; 
 
namespace NWLinq 
    public class TestViewModel 
    { 
        NWLinqDataContext dc = new NWLinqDataContext(); 
        public TestViewModel() 
        { 
            SetTable(); 
        } 
 
        public void SetTable() 
        { 
            var query = 
            from c in dc.Categories select c; 
            CategoryList = query.ToList(); ; 
        } 
 
        public IList<Category> CategoryList 
        { 
            get
            set
        } 
 
        public Category SelectedItem 
        { 
            get
            set
        } 
 
    } 
 

using System.Collections.Generic; 
using NWOpenAccess; 
using Telerik.OpenAccess; 
using Telerik.OpenAccess.Query; 
 
namespace NWOA 
    public class TestViewModel 
    { 
        private IObjectScope scope = NWScopeProvider.GetNewObjectScope(); 
        public TestViewModel() 
        { 
            SetTable(); 
        } 
 
        public void SetTable() 
        { 
            var query = 
            from c in this.scope.Extent<Category>() select c; 
            CategoryList = query.ToList(); ; 
        } 
 
        public IList<Category> CategoryList 
        { 
            get
            set
        } 
 
        public Category SelectedItem 
        { 
            get
            set
        } 
 
    } 
 

I won't paste the code for the LINQ designer or the OA designer. Basically, just use the Categories table. From Northwind.

On the grid, moving up and down, the textboxes are updated in both apps.

The problem: If I edit in the grid, the changes are reflected in the textbox for the LINQ program and NOT the OA program.

What am I missing?


A follow up question... what is the best way to save the changes back to the database, and when? When the user moves off the record? When a button is pressed to confirm?












Nedyalko Nikolov
Telerik team
 answered on 13 Aug 2009
1 answer
135 views

Hi.

I'm using a trial version of RadControls for WPF.

I was looking for a way to dynamically "Zoom" in/out a 2D chart( both the x and y axises).

I tried to change TicksDistance value to achieve this goal, but no use.
I thought a refresh might be needed so I added a Dispatcher.Invoke call, and steel no use.

On the AxisY I tried all the above replacing TicksDistance of AxisX with Step property of AxisY.
No use.

If "zooming" is possible in a 2D (Spline series) what is the correct way achieving it?
Thank you
Uriya

code snippet:

 

this

 

 

.mMyChart.RadChart1.DefaultSeriesDefinition = new SplineSeriesDefinition();

 

List

 

<Data> listData = new List<Data>();
for
(int i = 0; i < oc.OctaveNotes.Length; i++)  

 

 

{    listData.Add(

new Data(oc.OctaveNotes[i]));    }

 

this

 

.mMyChart.RadChart1.ItemsSource = listData;

 

 

 

 

 

if

 

(e.Delta > 0)//wheel up  

 

 

 

 

    Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance;  

    Step = Step / 4 * 5; 

 

    this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;  

 

else  

 

    Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance; 

    Step = Step / 5 * 4; 

 

    this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;  

}


this
.mMyChart.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, mEmptyDelegate);

 

 

 

 

 

 

public class Data  

 

    private DateTime mX; 

 

    public DateTime X  

    { 

 

        get { return mX; } 
       set { mX = value; }  

 

    }

 

 

 

    private Double mY;
    public Double Y

 

    { 

 

 

        get { return mY; } 

 

        set { mY = value; } 

    }

    public

 

Data(NoteInOctave note)  

 

 

 

    {

        mX = note.NoteDateTime; 

 

        Double.TryParse(note.MesuredValue, out mY);  

    }

 

}

 

 

 

Vladimir Milev
Telerik team
 answered on 13 Aug 2009
4 answers
75 views
Just recently I placed two threads on this forum and they have both been taken off! Why??

P
Valentin.Stoychev
Telerik team
 answered on 13 Aug 2009
12 answers
186 views
After uninstalling the 2009 Q1 SP1 release and then installing the 2009 Q1 SP2 release I notice that Telerik's RadControls for WPF does not show in my Vista Home Premium SP2 edition Control Panel/Programs as being installed.

When I went to retry the installation by running the originally downloaded msi I get asked if I want to repair or uninstall the RadControls for WPF. Whichever option I request fails with ".NET 3.5 is not installed" which is patently nonsense. (I am running Visual Studio 2008 SP1 and the Silverlight Controls are installed and working fine). The installation should not be in a state where it cannot be uninstalled or installed and I am now concerned that when the 2009 SP2 release becomes available I will not be able to install it (any install of an existing product invariably stops, insisting that you remove the previous version first).

I would raise a support ticket on this but there's no section I can see for installation. If I click on the WPF controls I'm then required to indicate which specific control I'm raising a support ticket on - which is nonsense of course because I'm raising a ticket on failed installation/clean-up.

Anybody know how I can fix my "working but not uninstallable" control set?

Clint
Top achievements
Rank 1
 answered on 12 Aug 2009
1 answer
475 views
Hi,
I have a GridView with binding to an ObservableCollection in the ViewModel.
The GridView DataLoadMode is set to Asynchronous.
When removing an item from the ObservableCollection in the ViewModel, the GridView is not refershed and item is still shown.
If I set DataLoadMode as synchronous , It works fine.

<telerik:RadGridView  
  x:Name="RadGridViewGroups" 
  Grid.Row="1" 
  AutoGenerateColumns="False" 
  DataLoadMode="Asynchronous" 
  IsReadOnly="True"           
  ItemsSource="{Binding Groups}" > 

public class GroupsViewModel : INotifyPropertyChanged  
{         
    public ObservableCollection<TradingGroup> Groups  
    {  
        get 
        {  
            return m_Groups;  
        }  
        set 
        {  
            m_Groups = value;  
            PropertyChanged.OnPropertyChanged(this"Groups");  
        }  
    }  


Thanks,
Noam Shoeg



Vlad
Telerik team
 answered on 12 Aug 2009
2 answers
171 views
Hy
I add a CheckBox  column to my grid
and now there is no border to the column
this is the code

<telerik:RadGridView.Resources> 
                    <ControlTemplate x:Key="cellTemplate" TargetType="{x:Type telerik:GridViewCell}">  
                        <CheckBox IsChecked="{Binding Field.Record.Data.Add, RelativeSource={RelativeSource TemplatedParent}}"   
                                                    HorizontalAlignment="Center" VerticalAlignment="Center" /> 
                    </ControlTemplate> 
                    <Style x:Key="booleanCellStyle">  
                        <Setter Property="telerik:GridViewCell.Template" Value="{StaticResource cellTemplate}" /> 
                    </Style> 
                    </telerik:RadGridView.Resources> 

 <telerik:RadGridView.Columns> 
                        <telerik:GridViewDataColumn UniqueName="Add" Header="" Width="Auto" CellStyle="{StaticResource booleanCellStyle}"/>  
                     

Thanks.
Orit
Top achievements
Rank 1
 answered on 12 Aug 2009
8 answers
188 views
Hi,
I am using RadCarousel in WAP Browser Application. I am calling this control in webpart using IFrame tag to run on sharepoint site.
when I deploy it I am getting follwoing error

PLATFORM VERSION INFO
    Windows             : 5.2.3790.131072 (Win32NT)
    Common Language Runtime     : 2.0.50727.3053
    System.Deployment.dll         : 2.0.50727.3053 (netfxsp.050727-3000)
    mscorwks.dll             : 2.0.50727.3053 (netfxsp.050727-3000)
    dfshim.dll             : 2.0.50727.3053 (netfxsp.050727-3000)

SOURCES
    Deployment url            : http://rell:1234/NewXbaps/WPFCarousel03.xbap
    Application url            : http://rell:1234/NewXbaps/WPFCarousel03.exe.manifest

IDENTITIES
    Deployment Identity        : WPFCarousel03.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=09b4372df65d1401, processorArchitecture=msil
    Application Identity        : WPFCarousel03.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=09b4372df65d1401, processorArchitecture=msil, type=win32

APPLICATION SUMMARY
    * Online only application.
    * Browser-hosted application.

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * An exception occurred while downloading the application. Following failure messages were detected:
        + Downloading http://rell:1234/NewXbaps/WPFCarousel03.exe did not succeed.
        + The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE.
    * An exception occurred while determining trust. Following failure messages were detected:
        + User has refused to grant required permissions to the application.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    No phase information is available.

ERROR DETAILS
    Following errors were detected during this operation.
    * [2/25/2009 6:29:45 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading http://rell:1234/NewXbaps/WPFCarousel03.exe did not succeed.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
            at System.Deployment.Application.DeploymentManager.SynchronizeAsyncWorker()
        --- Inner Exception ---
        System.Net.WebException
        - The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE.
        - Source: System
        - Stack trace:
            at System.Net.HttpWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
    * [2/25/2009 6:29:46 PM] System.Deployment.Application.TrustNotGrantedException (Unknown subtype)
        - User has refused to grant required permissions to the application.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ApplicationTrust.RequestTrust(SubscriptionState subState, Boolean isShellVisible, Boolean isUpdate, ActivationContext actCtx, TrustManagerContext tmc)
            at System.Deployment.Application.DeploymentManager.DetermineTrustCore(Boolean blocking, TrustParams tp)
            at System.Deployment.Application.DeploymentManager.DetermineTrust(TrustParams trustParams)
            at System.Deployment.Application.InPlaceHostingManager.AssertApplicationRequirements(Boolean grantApplicationTrust)
            at System.Deployment.Application.InPlaceHostingManager.AssertApplicationRequirements()
            at MS.Internal.AppModel.XappLauncherApp.AssertApplicationRequirementsAsync(Object unused)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.


can you tell me what changed i need to do?

Thanks
Vandana
Vlad
Telerik team
 answered on 12 Aug 2009
Narrow your results
Selected tags
Tags
+113 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?