Expander bindings broken?

4 posts, 1 answers
  1. Inger Marie
    Inger Marie avatar
    60 posts
    Member since:
    Nov 2010

    Posted 11 Feb Link to this post

    I have a RadExpander on a UserControl. The datacontext of the UserControl (and therefor of the RadExpander) is bound to the selecteditem of a RadDataGrid (a list/details solution).The datacontext is a viewmodel and all my viewmodels implements INotifyPropertyChanged.

    The first time I select an item in my datagrid, it goes well. After that, the pink textblock shows the previous Name (string) while the green shows the current.

    That seems like a bug to me.

    I cant just use the green one, because in my real solution I need to do complex stuff with datatriggers, but this is what it boils down to.

    Here is the XAML, and I have attached a picture from my running program:

    <telerik:RadExpander x:Name="_myExpander" Grid.Column="0" Grid.Row="2"  ExpandDirection="Down"
                   ToolTipService.Placement="Center" HorizontalContentAlignment="Stretch" Margin="0,0,2,0">
               <telerik:RadExpander.Style>
                   <Style TargetType="{x:Type telerik:RadExpander}">
                       <Setter Property="IsExpanded" Value="True" />
                       <Style.Triggers>
                           <DataTrigger Binding="{Binding}" Value="{x:Null}">
                               <Setter Property="IsExpanded" Value="False" />
                           </DataTrigger>
     
                       </Style.Triggers>
                   </Style>
               </telerik:RadExpander.Style>
               <telerik:RadExpander.Header>
                   <Border Margin="2, 0, -8, 0" Background="White" MinHeight="22">
                       <Grid  VerticalAlignment="Stretch">
                           <Grid.ColumnDefinitions>
                               <ColumnDefinition Width="Auto"/>
                               <ColumnDefinition Width="*"/>
                           </Grid.ColumnDefinitions>
     
                           
                            
                           <Grid  Margin="2,2,4,2"  Grid.Column="0"
                                   Background="LightPink">
                               <TextBlock >
                                   <TextBlock.Style>
                                       <Style TargetType="{x:Type TextBlock}">
                                           <Setter Property="Text" Value="{Binding Name}" />
                                       </Style>
                                   </TextBlock.Style>
                               </TextBlock>
                           </Grid>
                            
                           <Grid  Margin="14,2,4,2"  Grid.Column="1"
                                   Background="DarkSeaGreen">
                               <TextBlock Text="{Binding Name}" />
                           </Grid>
                                    
                       </Grid>
                   </Border>
               </telerik:RadExpander.Header>
               <telerik:RadExpander.Content>
               <TextBlock Margin="24,24,2,2" Text="Body" />
     
     
               </telerik:RadExpander.Content>
           </telerik:RadExpander>

  2. Answer
    Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 15 Feb Link to this post

    Hello Inger Marie,

    We have tried to reproduce the reported behavior on our side but without success. The RadExpander does not threats or modify the bindings located in its content. That is why we think that the problem might be located in the update of the ViewModels.

    I have attached a sample project based on your xaml, please take a look at it and modify it in order to reproduce the issue.

    Looking forward to hearing from you.

    Kind regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Inger Marie
    Inger Marie avatar
    60 posts
    Member since:
    Nov 2010

    Posted 22 Feb in reply to Kiril Vandov Link to this post

    Sorry for the late reply, I've been on holiday.

    In my example, I have two bindings inside the Expander - both binding to the same property on the same viewmodel. If the problem was in my update of viewmodels then both bindings would be wrong and both textboxes would show the wrong text.

    I don't think I can recreate the problem in a simplified solution, if you already tried that with my sample code. Unfortunately I cannot send you my solution as this would be the same as sending the source code of our product. However, I might find time to simplify the solution.

    As for my immidiate problem, I just used moved the stuff away from the header of the expander and into the "body". That solved my problem (and I didn't want the stuff in the header anyway because it looked weird :-).

  5. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 22 Feb Link to this post

    Hello Inger Marie,

    I am glad to hear that you have found a solution to your immediate problem. As for the binding problem we will be glad to further investigate the issue if we can get a project in which we can reproduce it.

    Kind regards,
    Kiril Vandov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top