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>
</DataTemplate>
</Setter.Value>
</Setter>
</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();
}
Hello Michael,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Working. Thanks. No further assistance required.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Hello,
Thank you for your post. I have been looking into it and I suggest you use the following expression if you want to get the TextBox’ Text in the RadioButton’s Click event handler:
string text = ((((sender as RadioButton).Parent as StackPanel).Children[1] as StackPanel).Children[2] as TextBox).Text;
Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.