Click here to Skip to main content
15,885,767 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to Set RadProgress bar on method load Pin
ramkie3-Dec-13 18:19
ramkie3-Dec-13 18:19 
AnswerRe: How to Set RadProgress bar on method load Pin
Mycroft Holmes3-Dec-13 18:53
professionalMycroft Holmes3-Dec-13 18:53 
QuestionPass values between windows Pin
shers2-Dec-13 6:35
shers2-Dec-13 6:35 
AnswerRe: Pass values between windows Pin
Elman905-Dec-13 23:02
Elman905-Dec-13 23:02 
AnswerRe: Pass values between windows Pin
Andy41120-Dec-13 2:36
Andy41120-Dec-13 2:36 
Questionhow to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 7:20
dharmaa.m1-Dec-13 7:20 
AnswerRe: how to access cell template control's in listview in wpf Pin
Mycroft Holmes1-Dec-13 11:48
professionalMycroft Holmes1-Dec-13 11:48 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 22:03
dharmaa.m1-Dec-13 22:03 
Thank you for reply.
According to you I've applied the following changes:
XML
<ListView  FontSize="13" Margin="1,2,3,0" Name="lsvCheck" Template="{DynamicResource ListViewControlTemplate1}" Height="139" VerticalAlignment="Top">
			<ListView.View>
				<GridView>
					<GridViewColumn DisplayMemberBinding="{Binding Row}" Header="Row" Width=" 30" />
                    <GridViewColumn DisplayMemberBinding="{Binding fldCheckNum}" Header="Number" Width=" 150" />
                             
                        <GridViewColumn Header="Passed" Width="100" x:Name="chk" >
                        <GridViewColumn.CellTemplate >
                            <DataTemplate>
                                        <CheckBox   Name="chkPassed"  />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                        <GridViewColumn Header="NotPassed" Width="100" x:Name="chk1">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                        <CheckBox    Name="chkNotPassed"  IsChecked="{Binding fldIsPass}" Checked="FindElement"  />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                   <GridViewColumn Header="RevivalDate" Width="160" x:Name="Coldate">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <DatePicker Visibility="Hidden" SelectedDate ="{Binding fldRevivalDate}"   Name="datePicker1"   />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
					
				</GridView>
			</ListView.View>
		
		</ListView>

and Method FindElement:
C#
private void FindElement(object sender, RoutedEventArgs e)
      {
          try
          {
             ListViewItem row= lsvCheck.ItemContainerGenerator.ContainerFromIndex(lsvCheck.SelectedIndex) as ListViewItem;
             DatePicker date = null;
              if (row != null)
              {

                  ContentPresenter templateParent = GetFrameworkElementByName<ContentPresenter>(row);
                  DataTemplate dataTemplate = Coldate.CellTemplate;
                  if (dataTemplate != null && templateParent != null)
                  {
                      row.ApplyTemplate();
                      date = dataTemplate.FindName("datePicker1", templateParent) as DatePicker;//Error                  }
                  if (date != null)
                  {
                       date.Visibility = Visibility.Visible;
                  }
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);

          }
      }
      private static T GetFrameworkElementByName<T>(FrameworkElement referenceElement) where T : FrameworkElement
      {
          FrameworkElement child = null;
          for (Int32 i = 0; i < VisualTreeHelper.GetChildrenCount(referenceElement); i++)
          {
              child = VisualTreeHelper.GetChild(referenceElement, i) as FrameworkElement;
              System.Diagnostics.Debug.WriteLine(child);
              if (child != null && child.GetType() == typeof(T))
              { break; }
              else if (child != null)
              {
                  child = GetFrameworkElementByName<T>(child);
                  if (child != null && child.GetType() == typeof(T))
                  {
                      break;
                  }
              }
          }
          return child as T;
      }

However, this error is:
"This operation is valid only on elements that have this template applied"
I do not know how to fix the error. In your opinion, where is the problem? And what do you suggest a way
Thanks for the idea!
AnswerRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani1-Dec-13 23:15
professionalVarsha Ramnani1-Dec-13 23:15 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m2-Dec-13 0:32
dharmaa.m2-Dec-13 0:32 
GeneralRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani2-Dec-13 1:10
professionalVarsha Ramnani2-Dec-13 1:10 
QuestionHow to send the parent name when we click on chlid Pin
Ashfaque Hussain29-Nov-13 3:41
Ashfaque Hussain29-Nov-13 3:41 
QuestionCreate two window by silverlight for windows embeded compact7 os Pin
yingkou21-Nov-13 2:09
yingkou21-Nov-13 2:09 
AnswerRe: Create two window by silverlight for windows embeded compact7 os Pin
Mycroft Holmes21-Nov-13 11:48
professionalMycroft Holmes21-Nov-13 11:48 
GeneralRe: Create two window by silverlight for windows embeded compact7 os Pin
yingkou23-Nov-13 18:02
yingkou23-Nov-13 18:02 
QuestionTrouble with MultiTrigger and IsMouseOver property Pin
t2b18-Nov-13 10:28
t2b18-Nov-13 10:28 
QuestionScroll Bar is not showing Pin
Ashfaque Hussain18-Nov-13 1:56
Ashfaque Hussain18-Nov-13 1:56 
AnswerRe: Scroll Bar is not showing Pin
t2b19-Nov-13 1:22
t2b19-Nov-13 1:22 
GeneralRe: Scroll Bar is not showing Pin
Ashfaque Hussain19-Nov-13 2:30
Ashfaque Hussain19-Nov-13 2:30 
GeneralRe: Scroll Bar is not showing Pin
t2b19-Nov-13 19:57
t2b19-Nov-13 19:57 
QuestionDisplaying border after adding Opacity mask for the image Pin
gourav852412-Nov-13 20:31
gourav852412-Nov-13 20:31 
AnswerRe: Displaying border after adding Opacity mask for the image Pin
RedDk16-Nov-13 11:00
RedDk16-Nov-13 11:00 
QuestionCombobox data wont update WPF MVVM Pin
LiquidHolic12-Nov-13 16:18
LiquidHolic12-Nov-13 16:18 
AnswerRe: Combobox data wont update WPF MVVM Pin
karthikeyal8712-Nov-13 22:58
karthikeyal8712-Nov-13 22:58 
GeneralRe: Combobox data wont update WPF MVVM Pin
LiquidHolic13-Nov-13 2:09
LiquidHolic13-Nov-13 2:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.