내가 만든 사용자 지정 탭 컨트롤이 있지만 문제가 있습니다. 사용자 지정 TabControl보기의 일부로 편집 가능한 TextBox가 있습니다.종속성 속성을 다른 속성에 바인딩
<Controls:EditableTextControl x:Name="PageTypeName"
Style="{StaticResource ResourceKey={x:Type Controls:EditableTextControl}}" Grid.Row="0" TabIndex="0"
Uid="0"
AutomationProperties.AutomationId="PageTypeNameTextBox"
AutomationProperties.Name="PageTypeName"
Visibility="{Binding ElementName=PageTabControl,Path=ShowPageType}">
<Controls:EditableTextControl.ContextMenu>
<ContextMenu x:Name="TabContextMenu">
<MenuItem Header="Rename Page Type" Command="{Binding Path=PlacementTarget.EnterEditMode, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
AutomationProperties.AutomationId="RenamePageTypeMenuItem"
AutomationProperties.Name="RenamePageType"/>
<MenuItem Header="Delete Page Type" Command="{Binding Path=PageTypeDeletedCommand}"
AutomationProperties.AutomationId="DeletePageTypeMenuItem"
AutomationProperties.Name="DeletePageType"/>
</ContextMenu>
</Controls:EditableTextControl.ContextMenu>
<Controls:EditableTextControl.Content>
<!--<Binding Path="CurrentPageTypeViewModel.Name" Mode="TwoWay"/>-->
<Binding ElementName="PageTabControl" Path="CurrentPageTypeName" Mode ="TwoWay"/>
</Controls:EditableTextControl.Content>
</Controls:EditableTextControl>
콘텐츠 섹션에서 CurrentPageTypeName이라는 종속성 보호 기능에 바인딩됩니다. 이 Depedency 소품은이 사용자 지정 Tab 컨트롤의 일부입니다. 나는 재산을 CurrentPageTypeName하기 위해, 실제 이름 값으로, 그때 내 재산을 결합 사용자 지정을 TabControl을 사용하고 다른보기에서
public static DependencyProperty CurrentPageTypeNameProperty = DependencyProperty.Register("CurrentPageTypeName", typeof(object), typeof(TabControlView));
public object CurrentPageTypeName
{
get { return GetValue(CurrentPageTypeNameProperty) as object; }
set { SetValue(CurrentPageTypeNameProperty, value); }
}
는 아래와 같이 :
<Views:TabControlView Grid.Row="0" Name="RunPageTabControl"
TabItemsSource="{Binding RunPageTypeViewModels}"
SelectedTab="{Binding Converter={StaticResource debugConverter}}"
CurrentPageTypeName="{Binding Path=RunPageName, Mode=TwoWay}"
TabContentTemplateSelector="{StaticResource tabItemTemplateSelector}"
SelectedIndex="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectedTabIndex}"
ShowPageType="Hidden" >
<!--<Views:TabControlView.TabContentTemplate>
<DataTemplate DataType="{x:Type ViewModels:RunPageTypeViewModel}">
<RunViews:RunPageTypeView/>
</DataTemplate>
</Views:TabControlView.TabContentTemplate>-->
</Views:TabControlView>
내 문제는 아무것도 보인다 없다는 것입니다 일어날 수 있습니다. 그것은 내 Chained Dependency Props가 아니라 Itemsource에서 Content를 가져옵니다. 나는 가능한 것을 시도하고 있는가? 그렇다면, 내가 뭘 잘못했는지.
감사합니다.
'PageTabControl'의'x : Name'을 볼 수 없으므로'ElementName = "PageTabControl"bindings가 실패 할 것이라고 상상할 수 있습니다. . 또한 'Itemsource'와 'Itemsource'에서 콘텐츠를 가져 오는 것이 무엇인지 물어볼 수 있습니까? –