2013-03-29 1 views
1

저는 지휘자가 Caliburn.Micro.Contrib의 ConductResult을 사용하여 새 항목을 활성화하려고합니다. 도체의 유형은 Conductor<IScreen>.Collection.OneActive이며 이미 올바르게 표시되고 작동하는 항목이 하나 있습니다.지휘자에서 활성화 된 새 항목이 표시되지 않습니다

그러나 새 항목은 활성화 된 후에 표시되지 않습니다. 이미 검사 한 지휘자의 ActiveItem이 새 항목으로 설정되고 새 항목 으로 활성화됩니다. 보기의 새 항목의 IsVisible도 true로 설정되어 있으므로 표시되지 않는 이유를 알 수 없습니다. 도체의 전망

XAML은 매우 간단하다 :

<UserControl x:Class="..." 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:cal="http://www.caliburnproject.org" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="auto" /> 
      <RowDefinition Height="auto" /> 
      <RowDefinition /> 
     </Grid.RowDefinitions> 

     <TextBlock Grid.Row="0" Text="{Binding Path=ActiveItem, Converter={StaticResource objectTypeConverter}}" Margin="5" /> 
     <ItemsControl Grid.Row="1" ItemsSource="{Binding Items}" BorderBrush="Aqua" BorderThickness="10 "> 
      <ItemsControl.ItemTemplate> 
       <DataTemplate> 
        <StackPanel> 
         <TextBlock Text="{Binding Converter={StaticResource objectTypeConverter},ConverterParameter=something}" Margin="5" /> 
        </StackPanel> 
       </DataTemplate> 
      </ItemsControl.ItemTemplate> 
     </ItemsControl> 
     <ContentControl Grid.Row="2" x:Name="ActiveItem" /> 
    </Grid> 
</UserControl> 

(TextBlock을하고 ItemsControl에이 디버깅 목적이있다, 그들은 새로운 항목 (즉, 항목의 컬렉션을 포함) 도체 내에서 수행되는 것을 증명하고 새로운 항목입니다 ActiveItem으로 설정)

+0

같은 문제가 있기 때문에 해결할 수 있습니까? –

+0

내가 기억하는 한, 이러한 유형의 문제 (지휘자의 새로 활성화 된 항목은 표시되지 않음)는 대개 지휘자 자체가 활성화되지 않은 (또는 상위 지휘자) 것이 었습니다. 그래서, 모든 부모 항목/지휘자가 적절하게 활성화되어 있으면 좀 더 살펴 보시기 바랍니다. – mnn

+0

오른쪽에 새 항목을 추가하면 잘 작동하기 때문에이 두 가지가 있습니다. 작동하지 않는 항목을 왼쪽에 추가하는 것입니다. 나는 전체 예제와 함께 비슷한 질문을하고있다. http://stackoverflow.com/questions/18835842/pivotitem-isnt-properly-activated-by-conductor-in-caliburn-micro –

답변

0

필자의 경우 상위 뷰 모델에 액세스하기 위해 IoC.Get<IShell>을 사용하고있었습니다.

기본 부트 스트 래퍼는 container.PerRequest<IShell, ShellViewModel>(); 입니다. 그래서 내 ShellViewModel 클래스의 다른 인스턴스를 가져 와서 항목을 올바르게 활성화했지만 UI가 업데이트되지 않았습니다.

수정 방법 중 하나는 container.PerRequest을 으로 대체하는 것입니다. 다른 변경 사항이 있습니다. IoC.Get<IShell>()((IShell)Parent)

관련 문제