Scrollviewer中的Textblock变得模糊

Scrollviewer中的Textblock变得模糊

本文介绍了[Windows Phone 8] Scrollviewer中的Textblock变得模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一个文本块的scrollviewer。

它们包含在一个弹出窗口中,弹出窗口有一个动画。



问题是文本块的内容变得模糊。我尝试了一切...我试图聚焦一个物体(scrollviewer),我试图改变不透明度等等......没有任何改变。

I've a scrollviewer that contains one textblock.
They are contained inside a popup and the popup has an animation.

The problem is that the content of the textblock, gets blurry. I tried everything... i tried to Focus an object (scrollviewer), i tried to change the opacity, etc... Nothing changed.

我该怎么办?

如果您需要一些XAML和C#代码样本,请询问。



谢谢。

What can i do?
If you need some XAML and C# code samples ask please.

Thank you.

Popup(XAML) :

Popup (XAML):

<Popup x:Name="PopupChoosePEProjChoise"
               IsHitTestVisible="True"
               IsOpen="{Binding PopupProjChoise}">
            <StackPanel Width="480"
                        Height="800"
                        Background="Transparent"
                        Tap="stackPanelProjChoise_Tap_1">
                <StackPanel x:Name="stackPanelProjChoise"
                        Width="400"
                        Opacity="0.9"
                        Margin="0,235,0,0"
                        RenderTransformOrigin="0.5,0.5">
                    <StackPanel.RenderTransform>
                        <CompositeTransform/>
                    </StackPanel.RenderTransform>

                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Tap">
                            <cmd:EventToCommand Command="{Binding ClosePopupOnScreenTap}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <Border Padding="15"
                        Background="#FF0B0E25"
                        BorderBrush="#FF314F7A"
                        CornerRadius="20"
                        BorderThickness="5">
                        <StackPanel HorizontalAlignment="Center"
                                VerticalAlignment="Center">

                            <TextBlock Text="Select the project to edit." />

                            <ScrollViewer MaxHeight="400">
                                <ListBox Width="340"
                                         BorderBrush="Transparent"
                                         BorderThickness="0"
                                         x:Name="lbEditProject"
                                         Tap="lbDeleteProject_Tap_1"
                                         ItemsSource="{Binding FullProjectsList}"
                                         SelectedItem="{Binding ChoiseSelectedProj, Mode=TwoWay}"
                                         Foreground="White"
                                         ItemContainerStyle="{StaticResource ChooseProjectListboxPickerTemplate}">
                                </ListBox>
                            </ScrollViewer>
                            <StackPanel VerticalAlignment="Bottom"
                                    Orientation="Horizontal">

                                <Button BorderBrush="Transparent"
                                        BorderThickness="0"
                                        Content="Edit Project"
                                        Background="#FF314F7A"
                                        toolkit:TiltEffect.IsTiltEnabled="True"
                                        FontSize="20"
                                        Width="360"
                                        Margin="0,10,65,0"
                                        Command="{Binding ToEditProjectCommand}">
                                    <Button.Template>
                                        <ControlTemplate>
                                            <Border CornerRadius="20"
                                                    Background="#FF22425D"
                                                    Padding="5">
                                                <ContentPresenter HorizontalAlignment="Center"
                                                                  VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </StackPanel>
            </StackPanel>
        </Popup>

列表框模板(XAML):

Listbox Template (XAML):

<Style x:Key="ChooseProjectListboxPickerTemplate" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border x:Name="Content"
                                Padding="3"
                                Background="Transparent"
                                Margin="0,15,0,0">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>

                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected">
                                        <Storyboard>
                                            <ColorAnimation Duration="0"
                                                            To="Transparent"
                                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                            Storyboard.TargetName="Content"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Duration="0"
                                                            To="#FF2B67AE"
                                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                            Storyboard.TargetName="Content"/>

                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content"
                                                                           Storyboard.TargetProperty="Opacity"
                                                                           >
                                                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                                                      Value="0.5"/>
                                                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                                      Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="SelectedUnfocused">
                                        <Storyboard>
                                            <ColorAnimation Duration="0"
                                                            To="#FF2B67AE"
                                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                            Storyboard.TargetName="Content"/>

                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content"
                                                                           Storyboard.TargetProperty="Opacity"
                                                                           >
                                                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                                                      Value="0.5"/>
                                                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                                      Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="0.5*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                </Grid.RowDefinitions>

                                <TextBlock Text="Name:"
                                           Opacity="0.6"
                                           Grid.Column="0"
                                           Grid.Row="0"
                                           FontSize="21"/>

                                <TextBlock Text="{Binding Name}"
                                           Grid.Column="1"
                                           Grid.Row="0"
                                           FontSize="21"/>

                            </Grid>

                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

动画(XAML):

        <Storyboard x:Name="PopupChooseProjAnimation">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                           Storyboard.TargetName="stackPanelProjChoise">
                <EasingDoubleKeyFrame KeyTime="0" Value="-411"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Name="PopupChooseProjAnimationInvert">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                           Storyboard.TargetName="stackPanelProjChoise">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-411"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

开始动画(代码隐藏C#):

Start Animation (Code-behind C#):

private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            if (ProjectsList.Items.Count > 0)
            {
                editing = true;

                SetBackContentOpacityAlternative();

                PopupChoosePEProjChoise.IsOpen = true;
                PopupChooseProjAnimation.Begin();
            }
            else
                MessageBox.Show("There isn't projects to edit.", "Error: No projects", MessageBoxButton.OK);
        }

结束动画(代码隐藏C#):

End Animation (Code-behind C#):

private void stackPanelProjChoise_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (openingdeletefunc == false)
            {
                PopupChooseProjAnimationInvert.Completed += (s, ev) =>
                {
                    editing = false;
                    SetBackContentOpacityNormal();
                    PopupChoosePEProjChoise.IsOpen = false;
                    ProjectsList.SelectedItem = null;
                };
                PopupChooseProjAnimationInvert.Begin();
            }
            openingdeletefunc = false;
        }







$







推荐答案


这篇关于[Windows Phone 8] Scrollviewer中的Textblock变得模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 08:50