findname

Is there a workaround for the missing FindName method in Silverlight's DataTemplate?

According to the C# compiler and the Silverlight 2 documentation, Silverlight doesn't provide a FindName method for the DataTemplate class. I want to find a Border that's inside a ContentPresenter. What's the best way in SilverLight 2? ...

Find ItemTemplate control in TreeView

My tree definition is: <TreeView Name="tree" ItemsSource="{Binding Children}" > <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}"> <CheckBox Name="foo"></CheckBox> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> Having a TreeViewItem element, I try t...

How to Find Children of a UserControl instead of a Window - replacing Window.FindName

I currently have a WPF project which has one main Window, and many UserControls which are children of this Window. Many of the children of this window are Tabs. I have successfully replaced my main Window with a User Control that implements almost exactly the same functionality as the Main Window. Replacing the Window with a UserContro...

Why doesnt Window.FindName() discover the x:Name of a button in a child UserControl? AKA how do NameScopes work?

So in the example code below, I create a UserControl UserControldChild which is a child of the main Window, Window1.xaml. Why does the FindName() method fail to find the "myButton" in the code below? This must have to do with the WPF XAML NameScopes, but I have yet to find a good explanation as to how NameScope works. Can someone enlig...

WPF Combox.FindName() doesn't work

Hi, I've got two comboboxes. The items of the first one i'm filling in Xaml with: <ComboBox Name="ddl_pageType" Width="200" BorderThickness="5"> <ComboBoxItem Name="Website" Content="Webseite"/> <ComboBoxItem Name="CNIProg" Content="Seite"/> </ComboBox> and the function ddl_pageType.FindName("Website")...

WPF - FindName Returns null when it should not

FindName is broken for me :( If you are an expert in such things I would love some help. The object I am looking for is there. I have proof. Here is the scenario: ToggleButton button = (ToggleButton)sender; Popup popup = (Popup)button.FindName("popSelectIteration"); popup is null but not always. Just sometimes. But even when it ...

Access Elements inside a DataTemplate... How to for more than 1 DataTemplate?

I've got 2 DataTemplates defined for a Listbox Control. 1 Template is for the UnSelected State and the other one is for the Selected State(showing more detail than the UnSelected State). I followed the example here: http://blogs.msdn.com/b/wpfsdk/archive/2007/04/16/how-do-i-programmatically-interact-with-template-generated-elements-pa...