XBAP: Missing Texts in Published Version

After publishing my XBAP application, I skip all (or some) of TextBlocks. It looks like this:

strange "feature"

Buttons should be marked, on the main screen there should be different text blocks.

To make things weirder:

  • This application works great when debugging.
  • Not all texts are always missing, some of them being time consuming.
  • I have implemented the changing form of LayoutTransform for processing using a hosting browser. On some sizes, all (or some) texts suddenly appear. (With a fixed LayoutTransform, sometimes texts are also missing). Instead, a change to RenderTransform does not change this behavior. Also does not remove the resizing.
  • The texts in the diagram I am drawing are missing. They are drawn in OnRender in the user control.
  • . , .NET 4.0. .NET 4.0 , .NET 4.0 , .NET 3.5

, ? , , ! !

Edit: , . . , , , .NET 4.0.

WPF Browser, Page1.xaml

<Page x:Class="BugDemo.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
    <Grid x:Name="LayoutRoot">
        <TextBlock FontSize="35" Text="Vanishing Text" />
        <Grid.LayoutTransform>
            <ScaleTransform />
        </Grid.LayoutTransform>
    </Grid>
</Page>

CodeBehind:

public partial class Page1 : Page
{
    public Page1()
    {
        InitializeComponent();    
        this.Loaded += AppPage_Loaded;
    }

    public double Scale
    {
        get { return ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX; }
        set
        {
            ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX = value;
            ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleY = value;
        }
    }

   void AppPage_Loaded(object sender, RoutedEventArgs e)
    {
        App.Current.MainWindow.SizeChanged += (o, args) => UpdateScale();
        UpdateScale();
    }

    private void UpdateScale()
    {            
        double xscale = (App.Current.MainWindow.ActualWidth) / 300;
        double yscale = (App.Current.MainWindow.ActualHeight) / 200;

        Scale = Math.Min(xscale, yscale);                       
    }
}

, " " . Debug.

+3
1

, - IE9.0. IE8.0 .

+2

Source: https://habr.com/ru/post/1774544/


All Articles