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

  • Home
  • SEARCH
  • 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 6646019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:21:43+00:00 2026-05-26T00:21:43+00:00

I have a class called CarSystemWindow that descends from Window, and it has a

  • 0

I have a class called CarSystemWindow that descends from Window, and it has a CanPinWindow boolean dependency property:

public class CarSystemWindow : Window {

    public static readonly DependencyProperty CanPinWindowProperty =
        DependencyProperty.Register( "CanPinWindow", typeof( bool ), typeof( CarSystemWindow ),
                 new FrameworkPropertyMetadata( false, FrameworkPropertyMetadataOptions.AffectsArrange ) );

    public bool CanPinWindow {
        get { return (bool) GetValue( CanPinWindowProperty ); }
        set { SetValue( CanPinWindowProperty, value ); }
    }

    . . .
}

In Generic.xaml, I have defined the default style for the CarSystemWindow class:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:CarSystem.CustomControls"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
                    xmlns:Telerik_Windows_Controls_Chromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls">

    <BooleanToVisibilityConverter x:Key="BoolToVisbility" />

    <Style TargetType="{x:Type local:CarSystemWindow}">
        <Setter Property="WindowState" Value="Maximized" />
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:CarSystemWindow}">
                    <Viewbox Name="LayoutRoot"  Stretch="Uniform">
                        <StackPanel>
                            <Grid Background="#FF3C4B66" Height="50" Name="PART_Title">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="50" />
                                    <ColumnDefinition Width="50" />
                                    <ColumnDefinition Width="50" />
                                </Grid.ColumnDefinitions>
                                <Label Content="{TemplateBinding Title}" 
                                       FontSize="32" 
                                       Foreground="White" 
                                       Grid.Column="0" 
                                       HorizontalAlignment="Left" 
                                       Name="PART_TitleLabel" />
                                <Button Grid.Column="1" 
                                        Margin="5" 
                                        Name="PART_PushpinButton" 
                                        Visibility="{Binding CanPinWindow, Converter={StaticResource BoolToVisbility}, RelativeSource={RelativeSource Self}}">
                                    <Image Name="PART_PushpinImage" Source="/CarSystem;component/Resources/Unpinned.png" />
                                </Button>
                                <Button Grid.Column="2" 
                                        Margin="5" 
                                        Name="PART_MinimizeButton">
                                    <Image Name="PART_MinimizeButtonImage" Source="/CarSystem;component/Resources/Minimize.png" />
                                </Button>
                                <Button Grid.Column="3" 
                                        Margin="5" 
                                        Name="PART_CloseButton">
                                    <Image Name="PART_CloseButtonImage" Source="/CarSystem;component/Resources/Close.png" />
                                </Button>
                            </Grid>

                            <Rectangle Fill="#FFE61E0F" Height="4" Name="PART_TitleBar" />

                            <Grid Background="#FF3C4B66" Height="25" Name="PART_SubTitle">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Label Content="{TemplateBinding DeviceType}" 
                                       FontSize="22" 
                                       Foreground="White" 
                                       Grid.Column="0" 
                                       HorizontalContentAlignment="Right" 
                                       Margin="5" 
                                       MinWidth="75" 
                                       Name="PART_DeviceTypeLabel" />
                                <Label Content="{TemplateBinding DeviceName}" 
                                       FontSize="22" 
                                       Foreground="White" 
                                       Grid.Column="1" 
                                       HorizontalContentAlignment="Left" 
                                       Margin="5" 
                                       MinWidth="250" 
                                       Name="PART_DeviceNameLabel" />
                                <Rectangle Fill="White" Grid.Column="2" Name="PART_SubTitleRight" />
                            </Grid>

                            <Rectangle Fill="#FF3C4B66" Height="4" Name="PART_TitleBottom" />

                            <ContentPresenter Name="PART_ClientArea" />

                        </StackPanel>
                    </Viewbox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    . . .

</ResourceDictionary>

The binding for the PART_PushpinButton Button’s Visibiility property isn’t working. The button is always visible, even though the property defaults to false. What am I doing wrong?

Tony

  • 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-26T00:21:44+00:00Added an answer on May 26, 2026 at 12:21 am

    I think the RelativeSource should be TemplatedParent, not Self. Or am I missing some part of your code?

    <Button Grid.Column="1" 
        Margin="5" 
        Name="PART_PushpinButton" 
        Visibility="{Binding CanPinWindow, Converter= {StaticResource BoolToVisbility}, RelativeSource={RelativeSource TemplatedParent}}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class called Question that has a property called Type. Based on
I have a class called Foo that has a function that looks like the
I have a class called Profile that has some simple properties and then it
I have a class called Item. Item has an identifier property called ItemCode which
I've got a custom control class in my project called CarSystemWindow. It descends from
I have a class called people that has its own name, id etc... I
I have Class CustomDate and that is referred in other class called Test. public
I have a class called Ship and a class called Lifeboat Lifeboat inherits from
I have a class called DatabaseHelper that wraps a DbConnection. What's the proper way
I have this class called Table: class Table { public string Name { get

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.