奇怪的sqares像Silverlight应用程序中的提示?

时间:2010-05-17 02:56:38

标签: silverlight-3.0

美好的一天!

鼠标悬停在Silverlight导航应用程序中的文本框,按钮等(类似提示)上时会出现奇怪的方块 - 如何将其删除?

scrin shot

一个例子.xaml页面:

<Code:BasePage x:Class="CAP.Views.Main" 
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
       mc:Ignorable="d"
       xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
       xmlns:Code="clr-namespace:CAP.Code"
       d:DesignWidth="640" d:DesignHeight="480"
       Title="Личный кабинет клиентов ООО АУРИТ">
<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <RowDefinition Height="103*" />
        <RowDefinition Height="377*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="120*" />
        <ColumnDefinition Width="520*" />
    </Grid.ColumnDefinitions>
    <Image Height="85" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="84" Margin="12,0,0,0" ImageFailed="image1_ImageFailed" Source="/CAP;component/Images/My-Computer.png" />
    <TextBlock Grid.Column="1" Height="Auto" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,12,0,0" Name="textBlock1" Text="Good day!" VerticalAlignment="Top" FontFamily="Verdana" FontSize="16" Width="345" FontWeight="Bold" />
    <TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Height="299" HorizontalAlignment="Left" Name="textBlock2"  VerticalAlignment="Top"  FontFamily="Verdana" FontSize="14" Width="441" >
       <Run Text="Some text "/><LineBreak/><LineBreak/><Run Text="and so on"/>
        <LineBreak/>
    </TextBlock>
</Grid>

xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using CAP.Code;

namespace CAP.Views
{
    public partial class Main : BasePage
    {
        public Main()  : base()
        {
            InitializeComponent();
            MapBuilder.AddToMap(new SiteMapUnit() { Caption = "Главная", RelativeUrl = "Main" },true);
            ((App)Application.Current).Mainpage.tvMainMenu.SelectedItems.Clear();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void image1_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {

        }
        protected override string[] NeededPermission()
        {
            return new string[0];
        }

    }
}

MainPage.xaml中

<UserControl
    x:Class="CAP.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Code="clr-namespace:CAP.Code"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
 xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    mc:Ignorable="d" Margin="0,0,0,0"  Width="auto" Height="auto" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">
    <ScrollViewer Width="auto"  Height="auto" BorderBrush="White" BorderThickness="0" Margin="0,0,0,0"   x:Name="sV" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
        <ScrollViewer.Content>
            <Grid Width="auto"  Height="auto" x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}"  Margin="0,0,0,0">
        <StackPanel Width="auto"  Height="auto" Orientation="Vertical" Margin="250,0,0,50">
            <Border x:Name="ContentBorder2" Margin="0,0,0,0" >
                <!--<navigation:Frame  Margin="0,0,0,0" Width="auto" Height="auto" x:Name="AnotherFrame"  VerticalAlignment="Top" Style="{StaticResource ContentFrameStyle}"  Source="/Views/Menu.xaml"  NavigationFailed="ContentFrame_NavigationFailed" JournalOwnership="OwnsJournal"  Loaded="AnotherFrame_Loaded">

                </navigation:Frame>-->
                <StackPanel Orientation="Vertical" Height="82" Width="Auto" HorizontalAlignment="Right" Margin="0,0,0,0" DataContext="{Binding}">
                   <TextBlock HorizontalAlignment="Right" Foreground="White" x:Name="ApplicationNameTextBlock4" Style="{StaticResource ApplicationNameStyle}" FontSize="20"
                   Text="Личный кабинет" Margin="20,16,20,0"/>
                   <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                <Image x:Name="imDoor" Visibility="Collapsed"  MouseEnter="imDoor_MouseEnter" MouseLeave="imDoor_MouseLeave" Height="24" Stretch="Fill" Width="25" Margin="10,0,10,0" Source="/CAP;component/Images/sm_white_doors.png" MouseLeftButtonDown="bTest_Click" />
                       <TextBlock x:Name="bLogout" MouseEnter="bLogout_MouseEnter" MouseLeave="bLogout_MouseLeave" TextDecorations="Underline" Margin="0,6,20,4" Height="23"  Text="Выйти" HorizontalAlignment="Right" Visibility="Collapsed" MouseLeftButtonDown="bTest_Click" FontFamily="Verdana" FontSize="13" FontWeight="Normal" Foreground="#FF1C1C92" />                                
                    </StackPanel>
                </StackPanel>
             </Border>
             <Border x:Name="bSiteMap" Margin="0,0,0,0" >
                 <StackPanel x:Name="spSiteMap" Orientation="Horizontal" Height="20" Width="Auto" HorizontalAlignment="Left" Margin="0,0,0,0" DataContext="{Binding}">
                           <!-- <TextBlock Visibility="Visible" TextDecorations="Underline"  Height="23" HorizontalAlignment="Left" x:Name="ar" Text="1" VerticalAlignment="Top" Foreground="Blue" FontFamily="Verdana" FontSize="13"  />
                            <TextBlock Visibility="Visible" Height="23" HorizontalAlignment="Left" x:Name="Map" Text="->" VerticalAlignment="Top" Foreground="Blue" FontFamily="Verdana" FontSize="13"  />
                            <TextBlock Visibility="Visible" TextDecorations="Underline"  Height="23" HorizontalAlignment="Left" x:Name="ar1" Text="2" VerticalAlignment="Top" Foreground="Blue" FontFamily="Verdana" FontSize="13"  />
                            <TextBlock Visibility="Visible" Height="23" HorizontalAlignment="Left" x:Name="Map1" Text="->" VerticalAlignment="Top" Foreground="Blue" FontFamily="Verdana" FontSize="13"  />
                            <TextBlock Visibility="Visible" TextDecorations="Underline"  Height="23" HorizontalAlignment="Left" x:Name="ar2" Text="3" VerticalAlignment="Top" Foreground="Blue" FontFamily="Verdana" FontSize="13"  />-->
                </StackPanel>
             </Border>
             <Border Width="auto"  Height="auto" x:Name="ContentBorder" Margin="0,0,0,0" >    

                        <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" 
                              Source="Main" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" ToolTipService.ToolTip=" " Margin="0,0,0,0">
                            <navigation:Frame.UriMapper>
                                <uriMapper:UriMapper> 

                                    <!--Client-->
                                    <uriMapper:UriMapping Uri="RegistrateClient" MappedUri="/Views/Client/RegistrateClient.xaml"/>
                                    <!--So on-->
                                </uriMapper:UriMapper>
                            </navigation:Frame.UriMapper>
                       </navigation:Frame>               

                </Border>

                </StackPanel>   


        <Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}" Margin="0,0,0,0" Background="{x:Null}" >
            <StackPanel Orientation="Vertical" Height="Auto" Width="250" HorizontalAlignment="Center" Margin="0,0,0,50" DataContext="{Binding}">
                <Image Width="150" Height="90"  HorizontalAlignment="Center"  VerticalAlignment="Top" Source="/CAP;component/Images/logo__au.png" Margin="0,20,0,70"/>

                <Border x:Name="BrandingBorder" MinHeight="222" Width="250" Style="{StaticResource BrandingBorderStyle3}" HorizontalAlignment="Center" Opacity="60" Margin="0,0,0,0">
                 <Border.Background>
                                <ImageBrush ImageSource="/CAP;component/Images/papka.png"/>
                 </Border.Background>
                    <Grid Width="250" x:Name="LichniyCabinet" Margin="0,10,0,0" HorizontalAlignment="Center" Height="211">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="19*" />
                                    <ColumnDefinition Width="62*" />
                                    <ColumnDefinition Width="151*" />
                                    <ColumnDefinition Width="18*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="13" />
                                    <RowDefinition Height="24" />
                                    <RowDefinition Height="35" />
                                    <RowDefinition Height="35" />
                                    <RowDefinition Height="43" />
                                    <RowDefinition Height="28" />
                                    <RowDefinition Height="32*" />
                                </Grid.RowDefinitions>
                                <TextBlock Visibility="Visible" Grid.Row="2" Height="23" HorizontalAlignment="Left" x:Name="tLogin" Text="Логин" VerticalAlignment="Top" FontFamily="Verdana" FontSize="13" Foreground="White" Margin="1,0,0,0" Grid.Column="1" />
                                <TextBlock Visibility="Visible"  FontFamily="Verdana" FontSize="13" Foreground="White" Height="23" HorizontalAlignment="Left" x:Name="tPassw" Text="Пароль" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" />
                                <TextBox  Visibility="Visible" Grid.Column="2" Grid.Row="2" Height="24" HorizontalAlignment="Left" x:Name="logLogin" VerticalAlignment="Top" Width="150" />
                                <PasswordBox Visibility="Visible" Code:DefaultButtonService.DefaultButton="{Binding ElementName=bLogin}" PasswordChar="*" Height="24" HorizontalAlignment="Left" x:Name="logPassword" VerticalAlignment="Top" Width="150" Grid.Column="2" Grid.Row="3" />
                                <Button  x:Name="bLogin"  MouseEnter="bLogin_MouseEnter" MouseLeave="bLogin_MouseLeave" Visibility="Visible" Content="Войти" Grid.Column="2" Grid.Row="4" Click="Button_Click" Height="23" HorizontalAlignment="Left" Margin="81,0,0,0" VerticalAlignment="Top" Width="70" />
                                <TextBlock MouseLeftButtonDown="ForgotPassword_MouseLeftButtonDown" MouseEnter="ForgotPassword_MouseEnter" MouseLeave="ForgotPassword_MouseLeave" Visibility="Visible" TextDecorations="Underline" Grid.ColumnSpan="2" Grid.Row="4" Height="23" HorizontalAlignment="Left" x:Name="ForgotPassword" Text="Забыли пароль?" VerticalAlignment="Top" Foreground="White" FontFamily="Verdana" FontSize="13" Grid.Column="1"   />
                                <TextBlock MouseEnter="tbRegistration_MouseEnter" MouseLeave="tbRegistration_MouseLeave" MouseLeftButtonDown="tbRegistration_MouseLeftButtonDown" Grid.Column="2" Grid.Row="6" Height="23" x:Name="tbRegistration"  TextDecorations="Underline" Text="Регистрация" VerticalAlignment="Top" FontFamily="Verdana" FontSize="13" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF1C1C92" FontWeight="Normal" Margin="0,0,57,0" />
                                <TextBlock  Cursor="Arrow"  Height="23" HorizontalAlignment="Left" Margin="11,-3,0,0"   Text="Личный кабинет" VerticalAlignment="Top" Grid.ColumnSpan="3" Grid.RowSpan="2" FontFamily="Verdana" FontSize="13" FontWeight="Bold" Foreground="White" />
                                <Image Visibility="Collapsed" Height="70" x:Name="imUser"  Stretch="Fill" Width="70" Grid.ColumnSpan="2" Margin="11,0,0,0" Grid.Row="2" Grid.RowSpan="2" Source="/CAP;component/Images/user2.png" />
                                <TextBlock x:Name="tbHello" Grid.Column="2" Visibility="Collapsed" Grid.Row="2" Height="auto" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="6,0,0,0"  Text="" VerticalAlignment="Top" FontFamily="Verdana" FontSize="13" Foreground="White" Width="145" />
                            </Grid>

            </Border>


            <Border x:Name="MenuBorder" Margin="0,0,0,50" Width="250" Visibility="Collapsed">                            
                    <StackPanel x:Name="spMenu" Width="240" HorizontalAlignment="Left">
                                <telerikNavigation:RadTreeView x:Name="tvMainMenu"
                                                               Width="240"
                                                               Selected="TreeView1_Selected"
                                                               SelectedValuePath="Text"
                                                               telerik:Theming.Theme="Windows7"
                                                               FontFamily="Verdana"
                                                               FontSize="12"/>                      
                    </StackPanel>
             </Border>    
        </StackPanel>
        </Grid>
                <Border x:Name="FooterBorder" VerticalAlignment="Bottom" Width="auto"   Height="76">
                    <Border.Background>
                        <ImageBrush ImageSource="/CAP;component/Images/footer2.png" />
                    </Border.Background>
                    <TextBlock  x:Name="tbFooter" Height="24"  Width="auto" Margin="0,20,0,0" TextAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Center" Foreground="White" FontFamily="Verdana" FontSize="11">

                    </TextBlock>
                </Border>
      </Grid>
        </ScrollViewer.Content>
    </ScrollViewer>
</UserControl>

MainPage.xaml.cs中

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using CAP.Code;
using CAP.Registrator;
using System.Windows.Input;
using System.ComponentModel.DataAnnotations;
using System.Windows.Browser;
using Telerik.Windows.Controls;
using System.Net;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CAP
{
    public partial class MainPage
    {
        public App Appvars = Application.Current as App;
        private readonly RegistratorClient registrator;
        public SiteMapBuilder builder;
        public MainPage()
        {
            InitializeComponent();
            sV.SetIsMouseWheelScrollingEnabled(true);           
            builder = new SiteMapBuilder(spSiteMap);
            try
            {
                //working with service
            }
            catch
            {
                this.ContentFrame.Navigate(new Uri(String.Format("ErrorPage"), UriKind.RelativeOrAbsolute));
            }
        }               




        /// Recursive method to update the correct scrollviewer (if exists)
        private ScrollViewer CheckParent(FrameworkElement element)
        {
            ScrollViewer _result = element as ScrollViewer;
            if (element != null && _result == null)
            {
                FrameworkElement _temp = element.Parent as FrameworkElement;
                _result = CheckParent(_temp);
            }
            return _result;
        }

        // If an error occurs during navigation, show an error window
        private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            e.Handled = true;
            ChildWindow errorWin = new ErrorWindow(e.Uri);
            errorWin.Show();
        }                          

    }   

}

1 个答案:

答案 0 :(得分:0)

我已经解决了问题!!!

它只是导航:框架

的属性ToolTipService.ToolTip =“”

!!!!!!!!!!!!!!!!!!!!!!