Задайте вопросЗадайте вопрос
 

Вопросis this bug?

  • 28 июня 2009 г. 20:06ORover Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    I have following user control:

    <

     

    UserControl x:Class="VDownloader.VideoElement"

     

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     

    Height="105" MouseDoubleClick="UserControl_MouseDoubleClick" MouseUp="UserControl_MouseUp">

     

     

    <UserControl.Resources>

     

     

    <ControlTemplate x:Key="DownloadButton" TargetType="{x:Type Button}">

     

     

    <Button x:Name="MyButton" Height="30" Width="30" VerticalAlignment="Bottom" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">

     

     

    <Image Source="/VDownloader;component/icons/download.png" Width="18" Height="18"></Image>

     

     

    </Button>

     

     

    <ControlTemplate.Triggers>

     

     

    <Trigger Property="IsMouseOver" Value="True">

     

     

    <Setter TargetName="MyButton" Property="Cursor" Value="Hand"></Setter>

     

     

    </Trigger>

     

     

    </ControlTemplate.Triggers>

     

     

    </ControlTemplate>

     

     

    <ControlTemplate x:Key="PlayButton" TargetType="{x:Type Button}">

     

     

    <Button x:Name="MyButton" Width="80" Height="30" Background="Transparent" HorizontalAlignment="Left" VerticalAlignment="Bottom" BorderBrush="Transparent">

     

     

    <Border BorderThickness="1" Background="Transparent" CornerRadius="1" BorderBrush="Gray">

     

     

    <StackPanel Orientation="Horizontal" Margin="1">

     

     

    <TextBlock Text=" Play now " VerticalAlignment="Center"></TextBlock>

     

     

    <Image Source="/VDownloader;component/icons/media_play.png" Width="19" Height="19" />

     

     

    </StackPanel>

     

     

    </Border>

     

     

    </Button>

     

     

    <ControlTemplate.Triggers>

     

     

    <Trigger Property="IsMouseOver" Value="True">

     

     

    <Setter TargetName="MyButton" Property="Cursor" Value="Hand"></Setter>

     

     

    </Trigger>

     

     

    </ControlTemplate.Triggers>

     

     

    </ControlTemplate>

     

     

    </UserControl.Resources>

     

     

    <Border Name="borderMain" BorderThickness="0" BorderBrush="DodgerBlue" Margin="2">

     

     

    <Grid>

     

     

    <Image Margin="107,7,77,0" Width="20" Height="20" Name="imgType" VerticalAlignment="Top" HorizontalAlignment="Left"></Image>

     

     

    <TextBlock Margin="130,7,77,0" Name="textVideoName" Height="23" VerticalAlignment="Top" Foreground="Blue" FontSize="12"></TextBlock>

     

     

    <TextBlock Margin="107,34,12,37" Name="textVideoDescr" TextWrapping="Wrap" />

     

     

    <!--<TextBlock Margin="107,54,12,37" Name="textTemp" TextWrapping="Wrap" />-->

     

     

    <Border BorderThickness="2" Margin="7,7,0,5" Width="94" BorderBrush="Blue" HorizontalAlignment="Left">

     

     

    <Image Name="image1" Stretch="Fill" />

     

     

    </Border>

     

     

    <StackPanel Orientation="Horizontal" Margin="107,63,0,5" >

     

     

    <Button Click="Button_Click" Name="btnDownload" Template="{StaticResource DownloadButton}" >

     

     

     

     

    </Button>

     

     

    <TextBlock Text=" "></TextBlock>

     

     

    <Button Name="btnBrowserGo" Click="btnBrowserGo_Click" Template="{StaticResource PlayButton}">

     

     

     

     

    </Button>

     

     

    </StackPanel>

     

     

    </Grid>

     

     

    </Border>

    </

     

    UserControl>

     

     



    draw attention MouseUp="UserControl_MouseUp" (select this element)

     

     


    this works fine in following areas (green) and does not work in red:

    http://www.magicscreenshot.com/MagicScreenshot/oiEtfaWIz0Y.jpg

    why?

     

    private void UserControl_MouseUp(object sender, MouseButtonEventArgs e)

    {

     

    if (UnSelectAll != null)

    UnSelectAll();

     

    Thickness think = new Thickness(2);

    borderMain.BorderThickness = think;

    }

    • ИзмененоORover 28 июня 2009 г. 20:09
    •  

Все ответы