Click here to Skip to main content
15,886,030 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Handle DataGrid Row Model Property Change Pin
Pete O'Hanlon21-Jun-17 21:46
mvePete O'Hanlon21-Jun-17 21:46 
GeneralRe: Handle DataGrid Row Model Property Change Pin
Kevin Marois22-Jun-17 4:01
professionalKevin Marois22-Jun-17 4:01 
GeneralRe: Handle DataGrid Row Model Property Change Pin
Pete O'Hanlon22-Jun-17 5:03
mvePete O'Hanlon22-Jun-17 5:03 
GeneralRe: Handle DataGrid Row Model Property Change Pin
Mycroft Holmes22-Jun-17 14:41
professionalMycroft Holmes22-Jun-17 14:41 
GeneralRe: Handle DataGrid Row Model Property Change Pin
Pete O'Hanlon22-Jun-17 21:18
mvePete O'Hanlon22-Jun-17 21:18 
GeneralStop user from killing of a running wpf application from background processes in task manager. Pin
Naushad Ansari15-Jun-17 23:24
Naushad Ansari15-Jun-17 23:24 
GeneralRe: Stop user from killing of a running wpf application from background processes in task manager. Pin
Pete O'Hanlon15-Jun-17 23:46
mvePete O'Hanlon15-Jun-17 23:46 
QuestionBind To DP On Control Pin
Kevin Marois15-Jun-17 5:26
professionalKevin Marois15-Jun-17 5:26 
I have created a RadioButton who's style will look similar to this. In my version the line can be top, left, right, or bottom.

In the code behind I did:
public class MaroisRadioButton : RadioButton
{
    public enum Position
    {
        Bottom,
        Left,
        Right,
        Top
    }

    #region DP RadioMarkPosition
    public static readonly DependencyProperty RadioMarkPositionProperty =
                DependencyProperty.Register("RadioMarkPosition",
                typeof(Position),
                typeof(MaroisRadioButton),
                new PropertyMetadata(Position.Left));

    public Position RadioMarkPosition
    {
        get { return (Position)GetValue(RadioMarkPositionProperty); }
        set { SetValue(RadioMarkPositionProperty, value); }
    }
    #endregion

    #region DP RadioMarkSize
    public static readonly DependencyProperty RadioMarkSizeProperty =
                DependencyProperty.Register("RadioMarkSize",
                typeof(double),
                typeof(MaroisRadioButton),
                new PropertyMetadata(null));

    public double RadioMarkSize
    {
        get { return (double)GetValue(RadioMarkSizeProperty); }
        set { SetValue(RadioMarkSizeProperty, value); }
    }
    #endregion
}

Then I created style for it and in the style I want to bind the RadioMarkSize to the Width property in the XAML:
<Border Grid.Row="1" 
        Grid.Column="0" 
        Margin="2" 
        Background="{DynamicResource buttonPressedBackBrush}"
        Width="{Binding RadioMarkSize}"
        HorizontalAlignment="Left"
        VerticalAlignment="Stretch"
        Name="LeftRadioMark"/>

But I can't get the binding to work. I get a binding error "BindingExpression path error: 'RadioMarkSize' property not found on 'object' ''MainWindowViewModel'"

How do I bind the Width property to the DP in the code behind?

Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Bind To DP On Control Pin
Pete O'Hanlon15-Jun-17 6:35
mvePete O'Hanlon15-Jun-17 6:35 
GeneralRe: Bind To DP On Control Pin
Kevin Marois15-Jun-17 6:39
professionalKevin Marois15-Jun-17 6:39 
GeneralRe: Bind To DP On Control Pin
Richard Deeming15-Jun-17 6:58
mveRichard Deeming15-Jun-17 6:58 
GeneralRe: Bind To DP On Control Pin
Kevin Marois15-Jun-17 7:03
professionalKevin Marois15-Jun-17 7:03 
AnswerRe: Bind To DP On Control Pin
BenScharbach12-Aug-17 9:06
BenScharbach12-Aug-17 9:06 
QuestionCommand Binding In User Control Pin
Kevin Marois9-Jun-17 12:24
professionalKevin Marois9-Jun-17 12:24 
AnswerRe: Command Binding In User Control Pin
Pete O'Hanlon9-Jun-17 21:26
mvePete O'Hanlon9-Jun-17 21:26 
GeneralRe: Command Binding In User Control Pin
Kevin Marois12-Jun-17 5:01
professionalKevin Marois12-Jun-17 5:01 
QuestionStyle User Control Pin
Kevin Marois22-May-17 5:19
professionalKevin Marois22-May-17 5:19 
AnswerRe: Style User Control Pin
eddieangel15-Sep-17 10:28
eddieangel15-Sep-17 10:28 
QuestionBind ColumnGroup text Pin
Mycroft Holmes18-May-17 16:01
professionalMycroft Holmes18-May-17 16:01 
AnswerRe: Bind ColumnGroup text (Resolved) Pin
Mycroft Holmes23-May-17 22:47
professionalMycroft Holmes23-May-17 22:47 
QuestionCustom SplitButton Control Styling Pin
Kevin Marois18-May-17 10:24
professionalKevin Marois18-May-17 10:24 
QuestionRe: Custom SplitButton Control Styling Pin
Gerry Schmitz18-May-17 11:34
mveGerry Schmitz18-May-17 11:34 
AnswerRe: Custom SplitButton Control Styling Pin
Kevin Marois18-May-17 12:37
professionalKevin Marois18-May-17 12:37 
GeneralRe: Custom SplitButton Control Styling Pin
Gerry Schmitz18-May-17 12:55
mveGerry Schmitz18-May-17 12:55 
GeneralRe: Custom SplitButton Control Styling Pin
Kevin Marois18-May-17 19:03
professionalKevin Marois18-May-17 19:03 

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.