TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nagaraju
NA
87
129.5k
How to access the controls
Aug 31 2011 5:12 AM
Hi,
i am having textblock called <TextBlock x:Name="tb_atype" Text="{Binding AType}" Visibility="Collapsed"></TextBlock> now i am binding the data to datagrid from database. in my database i am having values 1 and 2 for above textblock . now my requirement is how to access the value of the textblock and if the value is 1 i have to dispaly stackpanel called "radio" and the value is 2 i have to hide stackpanel radio and have to display the stackpanel called "checkbox". how can i achieve this one . for this in which event i have to writhe the code . can anybody please help me .
Thanks
p.Nagaraju
<sdk:DataGrid x:Name="Qpdatagrid" AutoGenerateColumns="False" ItemsSource="{Binding ElementName=dataSource, Path=Data}" LoadingRow="Qpdatagrid_LoadingRow" >
<sdk:DataGrid.Columns>
<sdk:DataGridTemplateColumn>
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel >
<StackPanel Orientation="Horizontal" x:Name="controls">
<!--<TextBlock Text="{Binding Path=QID}" />-->
<!--<TextBlock x:Name="tb_QID" />-->
<TextBlock x:Name="tb_atype" Text="{Binding AType}" Visibility="Collapsed"></TextBlock>
<sdk:Label x:Name="lbl_QID" Content="{Binding QID}" />
<TextBlock Text=")"/>
<TextBlock Text="{Binding Path=Question}" />
</StackPanel>
<StackPanel Orientation="Vertical" Height="100" x:Name="radio">
<!--<RadioButton x:Name="Option1" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option1}" />
<RadioButton x:Name="Option2" GroupName="{Binding group1}" Content="{Binding Option2}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" />
<RadioButton x:Name="Option3" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option3}" />
<RadioButton x:Name="Option4" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option4}"/>-->
<RadioButton x:Name="rd1" GroupName="{Binding OptionGroup}" Content="{Binding Option1}" IsChecked="{Binding}"></RadioButton>
<RadioButton x:Name="rd2" GroupName="{Binding OptionGroup}" Content="{Binding Option2}" IsChecked="{Binding}"></RadioButton>
<RadioButton x:Name="rd3" GroupName="{Binding OptionGroup}" Content="{Binding Option3}" IsChecked="{Binding}"></RadioButton>
<RadioButton x:Name="rd4" GroupName="{Binding OptionGroup}" Content="{Binding Option4}" IsChecked="{Binding}"></RadioButton>
</StackPanel>
<StackPanel Orientation="Vertical" x:Name="checkbox">
<CheckBox x:Name="chk1" Content="{Binding Option1}" IsChecked="{Binding Option1}" ></CheckBox>
<CheckBox x:Name="chk2" Content="{Binding Option2}" IsChecked="{Binding Option2}" ></CheckBox>
<CheckBox x:Name="chk3" Content="{Binding Option3}" IsChecked="{Binding Option3, Mode=OneWay}"></CheckBox>
<CheckBox x:Name="chk4" Content="{Binding Option4}" IsChecked="{Binding Option4, Mode=OneWay}"></CheckBox>
</StackPanel>
</StackPanel>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
Reply
Answers (
1
)
What is the event alternative for rowbound in datagrid
Hyperlink in Group Header of Data Grid