Reputation: 4947
I have an element in my XAML called Tasklst which I was able to reference it in my code-behind without a problem. However, when I introduced a tab control (as shown below) and moved my Tasklst inside a DataTemplate, suddenly my code-behind was telling me that Tasklst cannot find it. How do I reference it now?
<dx:DXTabControl x:Name="TabControl"
ItemsSource="{Binding Sequences}"
SelectionChanged="TabControl_OnSelectionChanged"
SelectedItem="">
<dx:DXTabControl.View>
<dx:TabControlMultiLineView HeaderLocation="Bottom" />
</dx:DXTabControl.View>
<!--Header-->
<dx:DXTabControl.ItemHeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</dx:DXTabControl.ItemHeaderTemplate>
<!--Content-->
<dx:DXTabControl.ItemTemplate>
<DataTemplate>
<views:DxTaskList x:Name="Tasklst" />
</DataTemplate>
</dx:DXTabControl.ItemTemplate>
</dx:DXTabControl>
Upvotes: 1
Views: 595
Reputation: 4116
DataTemplate is the Problem here ...
you can do something like this
(DxTaskList)TabControl.Template.FindName("Tasklst", TabControl);
Upvotes: 2