RadComboBox refrencing a RadGridView

5 posts, 0 answers
  1. Martin Egger
    Martin Egger avatar
    6 posts
    Member since:
    Mar 2010

    Posted 09 Apr 2010 Link to this post

    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.

  2. Martin Egger
    Martin Egger avatar
    6 posts
    Member since:
    Mar 2010

    Posted 11 Apr 2010 Link to this post

    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.





  3. UI for WPF is Visual Studio 2017 Ready
  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 15 Apr 2010 Link to this post

    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.
  5. Martin Egger
    Martin Egger avatar
    6 posts
    Member since:
    Mar 2010

    Posted 22 Apr 2010 Link to this post

    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.
  6. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 23 Apr 2010 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready