tags:

views:

2190

answers:

2

we have two textBlock like this: (we used .NET FW 3.0)

                    <TextBlock Grid.Column="0" Name="tabName" Style="{StaticResource textBlockBarStyle}" HorizontalAlignment="Left">
                        <TextBlock.Margin>
                            <Binding Converter="{StaticResource dpiConverter}">
                                <Binding.ConverterParameter>
                                    <Thickness Left="3" Top="6" Right="0" Bottom="0"/>
                                </Binding.ConverterParameter>
                            </Binding>
                        </TextBlock.Margin>
                    </TextBlock>

and

            <TextBox  x:Name="txtBoxHelp" 
                      IsReadOnly="True" Style="{DynamicResource txtBoxHelpStyle}" 
                      IsTabStop="False" 
                      Text="some text" MouseLeftButtonDown="txtBoxHelp_MouseLeftButtonDown">
                <TextBox.Margin>
                    <Binding Converter="{StaticResource dpiConverter}">
                        <Binding.ConverterParameter>
                            <Thickness Left="7" Top="0" Right="0" Bottom="0"/>
                        </Binding.ConverterParameter>
                    </Binding>
                </TextBox.Margin>
            </TextBox>

these two textBlock work well on others OS, but sometimes miss on the Windows XP Home Version with SP3. we have tried many ways to refresh these, but failed.

we tried: 1, UpdateLayout 2, InvalidateVisual 3, changed the set Text property in code to binding mode.

how to force these controls to refresh?

A: 
Soni Ali
I don't think this could solve the issue, because we have tried one-way binding.
Cooper.Wu
A: 

Thread thread = new Thread(new ThreadStart(delegate()
                {
                    Thread.Sleep(200); // this is important ...
                    try
                    {
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Send,
                            new NoArgsHandle(delegate()
                            {
                               // do something, set .Text = "some text"
                            }));
                    }
                    catch { }
                }));
                thread.Name = "thread-UpdateText";
                thread.Start();

It works well.

Cooper.Wu