Home Forums WPF controls Xceed DataGrid for WPF Unable to get the control from datagrid ‘s DataTemplate

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #26103 |

    Hi ,
    can any one tell me how to get the Cambobox control from the data template , unable to access teh control.
    ——————————–
    <DataTemplate x:Key=”colReinstatementType”>
    <StackPanel x:Name=”stkRT”>

    <ComboBox x:Name=”cmbReinstatementType” Grid.Column=”2″ HorizontalAlignment=”Stretch” Margin=”2,2,2,0″ IsSynchronizedWithCurrentItem=”True” SelectionChanged=”OnComboSelChange” >
    <ComboBoxItem>
    <TextBlock/>
    </ComboBoxItem>
    <ComboBoxItem>Own Motion</ComboBoxItem>
    <ComboBoxItem>Enforcement Agency</ComboBoxItem>
    </ComboBox>
    </StackPanel>
    <xcdg:DataGridControl x:Name=”grid”
    ItemsSource=”{Binding ElementName=uc123, Path=DataItems}”
    ItemScrollingBehavior=”Immediate” >
    <xcdg:Column FieldName=”ReinstatementType” Width=”200″
    Title=”Reinstatement Type” CellContentTemplate=”{StaticResource colReinstatementType}” />
    </xcdg:DataGridControl >
    =========================================
    DataRow rowUser1 = grid.GetContainerFromItem(grid.CurrentItem) as DataRow;

    System.Windows.Controls.ContentPresenter myContentPresenter = FindVisualChild<ContentPresenter>(rowUser1);
    DataTemplate myTemplate = (DataTemplate)this.Resources[“colReinstatementType”];

    System.Windows.Controls.ComboBox retrievedCheckBox = (ComboBox)myTemplate.FindName(“cmbReinstatementType”, myContentPresenter);
    retrievedCheckBox.SelectedIndex = 1;
    retrievedCheckBox.IsEnabled = IsEnabled;

    Thanks in advance

    Imported from legacy forums. Posted by asdf (had 2358 views)

    User (Old forums)
    Member
    Post count: 23064

    Did you solve it? I am also facing the same issues as mentionedm

    Imported from legacy forums. Posted by Jebarson (had 492 views)

    Xceed Support
    Member
    Post count: 5658

    You can handle the ComboBox’s Loaded event and retrieve a reference to it there (cast the sender as ComboBox).

    Imported from legacy forums. Posted by Jenny [Xceed] (had 765 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.