Click here to Skip to main content
16,004,778 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Accept Button and Data Binding inconsistency Pin
Pete O'Hanlon5-Jul-12 9:38
mvePete O'Hanlon5-Jul-12 9:38 
QuestionWPF Cascading filters Pin
Ross Cain4-Jul-12 8:45
Ross Cain4-Jul-12 8:45 
QuestionBinding Tooltip to template element Pin
Blikkies4-Jul-12 3:31
professionalBlikkies4-Jul-12 3:31 
AnswerRe: Binding Tooltip to template element Pin
Pete O'Hanlon4-Jul-12 3:40
mvePete O'Hanlon4-Jul-12 3:40 
GeneralRe: Binding Tooltip to template element Pin
Blikkies4-Jul-12 4:01
professionalBlikkies4-Jul-12 4:01 
GeneralRe: Binding Tooltip to template element Pin
Pete O'Hanlon4-Jul-12 4:16
mvePete O'Hanlon4-Jul-12 4:16 
AnswerRe: Binding Tooltip to template element Pin
vinodkrebc6-Jul-12 0:59
vinodkrebc6-Jul-12 0:59 
GeneralWPF Button Image Source Pin
Kevin Marois2-Jul-12 11:47
professionalKevin Marois2-Jul-12 11:47 
I created a button class:

public class ImageTextButton : Button
{
    public ImageSource NormalImageSource
    {
        get { return (ImageSource)GetValue(NormalImageSourceProperty); }
        set { SetValue(NormalImageSourceProperty, value); }
    }
    public static readonly DependencyProperty NormalImageSourceProperty =
        DependencyProperty.Register("NormalImageSource", typeof(ImageSource), typeof(ImageTextButton), new UIPropertyMetadata(null));


    public ImageSource MouseOverImageSource
    {
        get { return (ImageSource)GetValue(MouseOverImageSourceProperty); }
        set { SetValue(MouseOverImageSourceProperty, value); }
    }
    public static readonly DependencyProperty MouseOverImageSourceProperty =
        DependencyProperty.Register("MouseOverImageSource", typeof(ImageSource), typeof(ImageTextButton), new UIPropertyMetadata(null));


    public string Caption
    {
        get { return (string)GetValue(CaptionProperty); }
        set { SetValue(CaptionProperty, value); }
    }
    public static readonly DependencyProperty CaptionProperty =
        DependencyProperty.Register("Caption", typeof(string), typeof(ImageTextButton), new UIPropertyMetadata(null));
}


and I use it like this:

<controls:ImageTextButton Caption="Test"
                            NormalImageSource="Images/metro_save_disabled_48.png"
                            MouseOverImageSource="Images/metro_save_enabled_48.png"
                            Style="{StaticResource ImageTextButton}"
                            Grid.Row="1"
                            Grid.Column="1"/>


In the button's ControlTemplate I'm doing:

<ControlTemplate.Triggers>
    <Trigger Property="Button.IsMouseOver" Value="True">
        <Setter TargetName="ButtonImage" Property="Source" Value="{Binding RelativeSource={RelativeSource Self}, Path=MouseOverImageSource}" />
    </Trigger>
</ControlTemplate.Triggers>


but it doesn't work. The image doesn't change. It disappears. Anyone know the right way to do this?

Thanks
If it's not broken, fix it until it is

GeneralRe: WPF Button Image Source Pin
Unnikrishnan_S_N3-Jul-12 2:14
Unnikrishnan_S_N3-Jul-12 2:14 
GeneralRe: WPF Button Image Source Pin
Kevin Marois5-Jul-12 11:01
professionalKevin Marois5-Jul-12 11:01 
GeneralRe: WPF Button Image Source Pin
Unnikrishnan_S_N8-Jul-12 19:50
Unnikrishnan_S_N8-Jul-12 19:50 
GeneralWPF Button Style Problem Pin
Kevin Marois2-Jul-12 11:31
professionalKevin Marois2-Jul-12 11:31 
QuestionStyle Error Pin
Kevin Marois29-Jun-12 7:51
professionalKevin Marois29-Jun-12 7:51 
AnswerRe: Style Error Pin
Gerry Schmitz29-Jun-12 11:06
mveGerry Schmitz29-Jun-12 11:06 
GeneralRe: Style Error Pin
Kevin Marois29-Jun-12 11:10
professionalKevin Marois29-Jun-12 11:10 
AnswerRe: Style Error Pin
Richard MacCutchan29-Jun-12 21:17
mveRichard MacCutchan29-Jun-12 21:17 
GeneralBest Way To Design This Pin
Kevin Marois29-Jun-12 7:31
professionalKevin Marois29-Jun-12 7:31 
GeneralRe: Best Way To Design This Pin
Abhinav S1-Jul-12 7:22
Abhinav S1-Jul-12 7:22 
GeneralRe: Best Way To Design This Pin
Unnikrishnan_S_N3-Jul-12 20:14
Unnikrishnan_S_N3-Jul-12 20:14 
QuestionDefault font name of Silverlight XAML Pages Pin
yesu prakash29-Jun-12 0:24
yesu prakash29-Jun-12 0:24 
AnswerRe: Default font name of Silverlight XAML Pages Pin
Jeremy Hutchinson29-Jun-12 7:31
professionalJeremy Hutchinson29-Jun-12 7:31 
AnswerRe: Default font name of Silverlight XAML Pages Pin
Abhinav S1-Jul-12 6:22
Abhinav S1-Jul-12 6:22 
QuestionFooter in Silverlight DataGrid Pin
Sudhir Kumar Srivastava lko28-Jun-12 23:58
Sudhir Kumar Srivastava lko28-Jun-12 23:58 
AnswerRe: Footer in Silverlight DataGrid Pin
Abhinav S1-Jul-12 4:01
Abhinav S1-Jul-12 4:01 
QuestionShapes drawn on multiscale image prevent image mouse events. How to fix it? Pin
Member 780283927-Jun-12 3:53
Member 780283927-Jun-12 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.