Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeView crashes when item/s get removed #159

Closed
RefactoringRocks opened this issue Dec 11, 2015 · 4 comments
Closed

TreeView crashes when item/s get removed #159

RefactoringRocks opened this issue Dec 11, 2015 · 4 comments
Labels

Comments

@RefactoringRocks
Copy link

When we use the Style "MaterialDesignTreeViewItem" and remove items from the tree view (for example via MVVM -> ObservableCollection) the Style crashes the application with a NullReferenceException.

<VisualState x:Name="Expanded">
    <Storyboard>
        <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost"
                     To="1" Duration="0"/>
        <!-- TODO: This line here breaks the whole app when we remove items! -->
        <!--<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer"
                     To="1" Duration="0"/>-->
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
        </ObjectAnimationUsingKeyFrames>
    </Storyboard>
</VisualState>
<ScrollViewer Grid.Column="1" Grid.Row="1"
      x:Name="ItemsScrollViewer"
      Margin="-16 0 0 0"
      VerticalScrollBarVisibility="Hidden"
      Grid.ColumnSpan="2">
    <ScrollViewer.Tag>
        <system:Double>0.0</system:Double>
    </ScrollViewer.Tag>
    <!-- TODO: This line here breaks the whole app when we remove items! -->
    <!--<ScrollViewer.Height>
        <MultiBinding Converter="{StaticResource MathMlpMultipleConverter}">
            <Binding ElementName="ItemsHost" Path="ActualHeight"/>
            <Binding RelativeSource="{RelativeSource Self}" Path="Tag"/>
        </MultiBinding>
    </ScrollViewer.Height>-->
    <ItemsPresenter x:Name="ItemsHost"
            VerticalAlignment="Top"
            Opacity="0"
            Visibility="Collapsed"/>
</ScrollViewer>

The commented out code parts are throwing the exception.

@ButchersBoy
Copy link
Collaborator

😢

@l1pton17
Copy link
Contributor

@RefactoringRocks could you please provide an example? I have tried to obtain this error, but i could not.
I have made a pull request #160, you can check Domain\TreesViewModel.cs file in MainDemo.Wpf project.
treeviewexample

@ButchersBoy ButchersBoy modified the milestones: ver 1.4, ver 1.3 Dec 27, 2015
@ButchersBoy
Copy link
Collaborator

@RefactoringRocks are you able to provide an example of this breaking?

@ButchersBoy ButchersBoy removed this from the ver 1.4 milestone Jan 15, 2016
@ButchersBoy
Copy link
Collaborator

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants