Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1425
XamDataGrid 13.2 Getting LabelPresenterStyle DataTemplate child control value
posted

In my XamDataGrid I have MANY fields defined as such:

<

 

igDP:Field Name="R_Pressure" Column="19" Row="1" Tag="0::SHD,PHD:BGS,BOS,NBS" DisallowModificationViaClipboard="True">

                                          

<igDP:Field.Settings>

                                               

<igDP:FieldSettings AllowEdit="False" EditAsType="{x:Type sys:Double}" Width="90" CellValuePresenterStyle="{StaticResource CVP_TransparentBlue}">

                                                   

<igDP:FieldSettings.EditorStyle>

                                                       

<Style TargetType="{x:Type igEditors:XamNumericEditor}">

                                                           

<Setter Property="Format" Value="{Binding Text, ElementName=textBlockPressureFormat, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue='########0.0########'}"/>

                                                           

<Setter Property="Mask" Value="{Binding Text, ElementName=textBlockPressureMask, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue='{}{double:-9.9}'}"/>

                                                           

<Setter Property="PromptChar" Value=" "/>

                                                       

</Style>

                                                   

</igDP:FieldSettings.EditorStyle>

                                                   

<igDP:FieldSettings.LabelPresenterStyle>

                                                       

<Style TargetType="{x:Type igDP:LabelPresenter}">

                                                           

<Setter Property="ContentTemplate">

                                                               

<Setter.Value>

                                                                   

<DataTemplate>

                                                                       

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

                                                                           

<RadioButton x:Name="HeaderRadioButton" GroupName="ResultsView" Click="HeaderRadioButton_Click"/>

                                                                           

<StackPanel Orientation="Vertical">

                                                                               

<TextBlock Text="Flowing" FontSize="9" HorizontalAlignment="Center"/>

                                                                               

<TextBlock Text="Pressure" FontSize="9" HorizontalAlignment="Center"/>

                                                                               

<TextBox Text="{Binding Text, ElementName=textBlockPressureUnits}" Height="22" Width="45" FontSize="9" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" Background="Transparent"/>

                                                                           

</StackPanel>

                                                                       

</StackPanel>

                                                                   

</DataTemplate>

                                                               

</Setter.Value>

                                                           

</Setter>

                                                       

</Style>

                                                   

</igDP:FieldSettings.LabelPresenterStyle>

                                               

</igDP:FieldSettings>

                                           

</igDP:Field.Settings>

                                       

</igDP:Field>

 

In the HeaderRadioButton_Click handler, I need to get the value of the TextBox.

How can I do this.

Following is my event handler.

BTW. How do we format pasted code for this forum?

private void HeaderRadioButton_Click(object sender, RoutedEventArgs e)

{

LabelPresenter lp = ((((sender as System.Windows.Controls.RadioButton).TemplatedParent as ContentPresenter).TemplatedParent as ContentControl).Parent as Grid).TemplatedParent as LabelPresenter;

            viewModel.ColorScalePropertyToMap = lp.Field.Name;

            Refresh3DView();

        }