This is a migrated thread and some comments may be shown as answers.

RadComboBox refrencing a RadGridView

4 Answers 90 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Martin Egger
Top achievements
Rank 2
Martin Egger asked on 09 Apr 2010, 08:23 PM
First of all I wanna say that I just started learning C# and XAML. I got very interested in the use of the Rad Controls and had some problems to implement a RadComboBox which refrences the selected Item in a RadGridView.

My goal is to develop a Master Detail View which uses the RadGridView for selection and a form with comboboxes and textboxes.

I am using Entity Framework and .Net 3.5

Here is my XAML Sourcecode:
    <DockPanel> 
        <Grid DockPanel.Dock="Top" > 
            <Grid.ColumnDefinitions> 
                 
            </Grid.ColumnDefinitions> 
            <Grid.RowDefinitions> 
                <RowDefinition /> 
                <RowDefinition /> 
            </Grid.RowDefinitions> 
            <StackPanel Grid.Row="0" x:Name="PlattenDetail" DataContext="{Binding Source={StaticResource PlattenView}}"
                 
                 <telerik:TextBoxEditor Text="{Binding ElementName=radGridView1, Path=SelectedItem.platteID}"></telerik:TextBoxEditor> 
                 <telerik:RadComboBox x:Name="CBLieferant" > 
 
                </telerik:RadComboBox> 
 
 
 
            </StackPanel> 
 
            <telerik:RadGridView Grid.Row="1"  Name="radGridView1" ItemsSource="{Binding Source={StaticResource PlattenView}}" AutoGenerateColumns="False" Height="582" Margin="-8,0,0,-198" 
                               > 
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewDataColumn Header="ID" DataMemberBinding="{Binding platteID}" /> 
                    <telerik:GridViewDataColumn Header="Lieferant" DataMemberBinding="{Binding Path=preise.lieferant.lieferantName1}" /> 
                </telerik:RadGridView.Columns> 
          
                     
 
 
            </telerik:RadGridView> 
         
        </Grid> 
 
    </DockPanel> 

As you can see I didn't populate the ComboBox with any properties. I did this because I just did alot of trial and error with SelectedItem SelectedValue(Path) and so on and never came to a result like it worked for the textbox.

Hopefully you can help me with this issue.

4 Answers, 1 is accepted

Sort by
0
Martin Egger
Top achievements
Rank 2
answered on 11 Apr 2010, 09:42 PM
Well I don't know if I am stupid for the last few weeks. I was trying everthing until today I realised that I am working with a RadGridView as a Master and TextBoxes and Comboboxes as Detail.

I don't know why I always was thinking that I was working with a ListView as a Master. Therefore always looking for does documentations. In the end I solved my problem partially with SelectionChange Event.

Though I am not finished yet I will provide my solution in the next few days.

Thx anyway.

UPDATE

Following Problem.
When a differtent Item is selected within the RadGridView it changes the values in the detailview.

private void radGridView1_SelectionChanged(object sender,SelectionChangeEventArgs e) 
        { 
            Platten platten = this.radGridView1.SelectedItem as Platten; 
            txtBoxEditorPlattenNummer.Text = platten.plattenNummer; 
            txtBoxEditorPlattenName1.Text = platten.plattenName1; 

When I do the same for the Comboboxes it won't work.
CDM.DataAccessLayer.Style style = this.radGridView1.SelectedItem as CDM.DataAccessLayer.Style; 
 
            radComboBoxStyle.Text = style.stylName; 

When I use "Jazz" instead of style.stylName it works perfectly.

Thx.





0
Konstantina
Telerik team
answered on 15 Apr 2010, 09:22 AM
Hello Martin,

Thank you for contacting us.

Unfortunately, from your code snippets we cannot understand what might be the problem. So, when you are finished, could you please send us a sample project, which we can run here locally in order to track the issue and resolved it in a timely manner.

Looking forward to your reply.

All the best,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Martin Egger
Top achievements
Rank 2
answered on 22 Apr 2010, 11:27 AM
comboBoxLieferanten.SetValue(RadComboBox.TextProperty, (platten.preis.lieferant.lieferantName1)); 
                comboBoxStyle.SetValue(RadComboBox.TextProperty, (platten.styl.stylName)); 
                comboBoxPreise.SetValue(RadComboBox.TextProperty, (platten.preis.plCode)); 
I solved my problem. Managed it with the SelectionChanged Event of the RadGridView.
0
Konstantina
Telerik team
answered on 23 Apr 2010, 09:37 AM
Hi Martin,

We are glad that you have resolved the issue yourself.

If you have any other questions regarding our controls please let us know.

Best wishes,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Martin Egger
Top achievements
Rank 2
Answers by
Martin Egger
Top achievements
Rank 2
Konstantina
Telerik team
Share this question
or