Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
xamdatagrid Control's row position changes AFTER SCROLLING
posted

I am using ControlTemplate to display 2 controls (below is xaml used). When I scroll down using mouse-scroll or scrollbar, and bring back that row in view, then the first textblock Displays on different row. it happens randomly. In first run, all controls display on their respective row position.

what should I do to make both textblock stick to their respective rows.

 

<Style x:Key="StyleDecimal2" TargetType="{x:Type igEditors:XamTextEditor}">
            <Setter Property="BorderBrush" Value="LightGray"/>
            <Setter Property="BorderThickness" Value="0,0,1,0"/>
            <Setter Property="HorizontalContentAlignment" Value="Right" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                        <DockPanel>

 <!-- THIS TEXTBLOCK RANDOMLY CHANGES ROW -->

                            <TextBlock Text="!" x:Name="img1" Foreground="Red" FontWeight="ExtraBold"
                                       HorizontalAlignment="Left" FontSize="12"
                                       ToolTip="overriden with a value of 1." >
                            <TextBlock.Visibility>
                                <MultiBinding Converter="{StaticResource convMulti3}">
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"/>
                                </MultiBinding>
                            </TextBlock.Visibility>
                            </TextBlock>

 <!-- THIS TEXTBLOCK ALWAYS DISPLAYS ON CORRECT ROW -->

                            <TextBlock HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
         x:Name="TextBlock" Foreground="{TemplateBinding

DisplayText, Converter={StaticResource colorConverter}}" Text="{TemplateBinding DisplayText}"/>
                            </DockPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>


 <!-- I AM NOT DOINGH EDIT, SO NO NEED TO WORRY ABOUT EDIT -->

            <Setter Property="EditTemplate">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                            <TextBox x:Name="PART_FocusSite"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>