Dostęp do wewnętrznej nazwy

0

Witam, mam taki problem, jak z codu behind mieć dostęp do np. Label w tym wypadku o nazwie "xwc"

         <DataGrid  Name="datagrid"  Margin="5,0,5,0" GridLinesVisibility="None" CanUserAddRows="False" ItemsSource="{Binding nowy}" >
                <DataGrid.Columns>
                    <DataGridTemplateColumn>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Expander Name="expander" IsExpanded="False" Collapsed="sw" Expanded="pos"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
                <DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Place of arrival:"/>
                            <Label Name="xwc"/>
                            <!--<DataGrid CanUserAddRows="False" ItemsSource="{Binding Source={StaticResource ResourceKey=data}, Path=flight_list}" HeadersVisibility="All"/>
                       --> </StackPanel>
                    </DataTemplate>
                </DataGrid.RowDetailsTemplate>
            </DataGrid>

Datagrid o nazwie "datagrid" jest widoczna w C#, ale już Label "xwc" w RowDetailsTemplate nie.

0

Używaj Binding dla elementów Labela które chcesz modyfikować nie kombinuj na sile. A jak chcesz kombinować i się męczyć to google: datatemplate access behind code

1 użytkowników online, w tym zalogowanych: 0, gości: 1