Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:23:29+00:00 2026-05-26T14:23:29+00:00

I have a small polygon written on the large canvas. I want to highlight

  • 0

I have a small polygon written on the large canvas. I want to highlight a polygon when mouse is moving over the canvas. The code is like this:

<UserControl ...>
  <Canvas Name="canvas" Height="22" Width="22">
      <Canvas.Resources>
          <Style TargetType="Canvas">
              <Style.Triggers>
                  <Trigger Property="IsMouseOver" Value="false">
                      <Setter Property="polygon.Stroke" Value="#EEEEEE"/>
                  </Trigger>
                  <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="polygon.Stroke" Value="Aqua"/>
                </Trigger>
              </Style.Triggers>
          </Style>
      </Canvas.Resources>
      <Polygon Points="11,1 16,6 16,16 11,21" Name="polygon">
              <Polygon.Fill>
                  <SolidColorBrush Color="#EEEEEE"/>
              </Polygon.Fill>
      </Polygon>
  </Canvas>
</UserControl>

However setter does not see the “polygon”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:23:30+00:00Added an answer on May 26, 2026 at 2:23 pm

    You cannot use Setters like that, if you use this kind of notation the engine will look for an attached property, or if no Style.TargetType was set for a property on the type before the dot.

    The easiest thing to do is probably applying a style to the polygon itself and using a DataTrigger which binds to the Canvas so you can trigger on its properties.

      <Polygon Points="11,1 16,6 16,16 11,21" Name="polygon">
           <Polygon.Fill>
               <SolidColorBrush Color="#EEEEEE"/>
           </Polygon.Fill>
           <Polygon.Style>
              <Style TargetType="{x:Type Polygon}">
                 <Style.Triggers> 
                    <DataTrigger
                       Binding="{Binding Path=IsMouseOver,
                                         RelativeSource={RelativeSource
                                         AncestorType={x:Type Canvas}}}"
                       Value="True">
                       <Setter Property="Stroke" Value="Red"/>
                    </DataTrigger>
                 </Style.Triggers>
              </Style>
           <Polygon.Style>
      </Polygon>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have small web page at www.peterbio.com/mom/test.htm Someone wrote the code with mouse over and
I have small problem with my SQL code: UPDATE articles SET like=like+1 WHERE id=1
I have small question regarding the following error: this.context.sourceCache On a custom control I
I have small problem with mysql. I have data in table and I want
I have a small map and I want to show two different information categories
I have small problem and I'd like to solve it with dynamical menu: public
I have small image hosting and I realized there many duplicate content. I want
I have small piece of code boost::asio::ip::tcp::no_delay option(true); boost::asio::ip::tcp::socket* sock = new boost::asio::ip::tcp::socket(ios); sock->set_option(option);
I have small code as shown below public class Testing { public static void
I have small problem with my .net 2.0 winforms application. I want to embed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.