Click here to Skip to main content
16,020,182 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Richard MacCutchan3-Sep-22 21:01
mveRichard MacCutchan3-Sep-22 21:01 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
mjeeves3-Sep-22 8:58
mjeeves3-Sep-22 8:58 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz4-Sep-22 8:57
mveGerry Schmitz4-Sep-22 8:57 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Richard Deeming5-Sep-22 21:11
mveRichard Deeming5-Sep-22 21:11 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz6-Sep-22 5:34
mveGerry Schmitz6-Sep-22 5:34 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Marc Jeeves6-Sep-22 10:05
Marc Jeeves6-Sep-22 10:05 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz6-Sep-22 13:19
mveGerry Schmitz6-Sep-22 13:19 
QuestionCan Not Bin to Dependency Property in Custom Control Pin
Marc Jeeves1-Sep-22 6:26
Marc Jeeves1-Sep-22 6:26 
Within my View Model i have a property and backer to bind to the ControlHideShow, I don't get a bind error but if I change the default value in the View Model nothing happens.  If I don't bind in the Implementation XAML and set Visible or Hidden it works so why can I not bind to the ViewModel

thanks

Madaxe


Public interface ViewModel
{
        Visibility ControlHideShow { get; set; }
}
    
public class MainPageViewModel : ViewModelBase, IMainPageViewModel
{
    
        private Visibility _controlHideShow = Visibility.Visible;
        public Visibility ControlHideShow
        {
            get => _controlHideShow;
            set{ _controlHideShow = value;  OnPropertyChanged(nameof(ControlHideShow)); }
        }
}

Implementation XML
<controls:WaitTicker_Control
                        x:Name="WaitCursor"
                        Width="60" Height="30"
                        Grid.Row="4" Grid.Column="1" 
                        HorizontalAlignment="Center" 
                        VerticalAlignment="Center"
                        Margin="100 0 0 0"
                
                        ControlBackground1="#FFA5CD3C"
                        ControlBackground2="#FF208D2F" 
                        ControlBackground3="#FF206A8D" 
                
                        ControlCornerRadius1="2" 
                        ControlCornerRadius2="2"
                        ControlCornerRadius3="2"           
                
                        PulseHeight1="25" PulseHeight2="25" PulseHeight3="25"
                        PulseWidth1="5" PulseWidth2="5" PulseWidth3="5"
                        PulseMaxValue="50" PulseMinValue="5"
                        PulseSpeedValue="0.0001"
                        PulseIncrementValue="1" 
                        PulseCurrentValue1="1" PulseCurrentValue2="25" PulseCurrentValue3="50"
                        ControlHideShow="{Binding ControlHideShow}"/>

Custom Control XAML
<UserControl x:Class="DES.CATIAV6.ClearanceContactAndClashManager.UI.Controls.WaitTicker_Control"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:local="clr-namespace:DES.CATIAV6.ClearanceContactAndClashManager.UI.Controls"
                 mc:Ignorable="d" 
                 DataContext="{Binding RelativeSource={RelativeSource Self}}" 
                 Background="Transparent" 
                 Height="70" Width="60"
                 Name="WaitTickerControl">
        <Grid Name="WaitTickerMainGrid" Visibility="{Binding Path=ControlHideShow,ElementName=WaitTickerControl, FallbackValue=Hidden}">

        </Grid>
    
    </UserControl>

Custom Control Code Behind
    public partial class WaitTicker_Control : UserControl, INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler? PropertyChanged;
    
            protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }

    
            public Visibility ControlHideShow
            {
                get { return (Visibility)GetValue(ControlHideShowProperty); }
                set { SetValue(ControlHideShowProperty, value); }
            }
            public static readonly DependencyProperty ControlHideShowProperty =
                DependencyProperty.Register("ControlHideShow", typeof(Visibility), typeof(WaitTicker_Control),
                   new PropertyMetadata(Visibility.Hidden));

          

AnswerRe: Can Not Bin to Dependency Property in Custom Control Pin
Richard Deeming1-Sep-22 6:35
mveRichard Deeming1-Sep-22 6:35 
GeneralRe: Can Not Bin to Dependency Property in Custom Control Pin
Marc Jeeves1-Sep-22 6:47
Marc Jeeves1-Sep-22 6:47 
QuestionWhat is the most common MVVM framework used today? Pin
Code4Ever21-Jul-22 7:26
Code4Ever21-Jul-22 7:26 
AnswerRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon21-Jul-22 21:21
mvePete O'Hanlon21-Jul-22 21:21 
AnswerRe: What is the most common MVVM framework used today? Pin
Richard Deeming21-Jul-22 21:22
mveRichard Deeming21-Jul-22 21:22 
AnswerRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz22-Jul-22 5:10
mveGerry Schmitz22-Jul-22 5:10 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon24-Jul-22 11:32
mvePete O'Hanlon24-Jul-22 11:32 
GeneralRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz25-Jul-22 20:43
mveGerry Schmitz25-Jul-22 20:43 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon25-Jul-22 21:30
mvePete O'Hanlon25-Jul-22 21:30 
QuestionIs it possible to do event handling in the ViewModel? Pin
Code4Ever16-Jul-22 6:39
Code4Ever16-Jul-22 6:39 
AnswerRe: Is it possible to do event handling in the ViewModel? Pin
Gerry Schmitz17-Jul-22 6:06
mveGerry Schmitz17-Jul-22 6:06 
QuestionDICOM TAGS Pin
harol espinosa26-Jun-22 5:20
harol espinosa26-Jun-22 5:20 
AnswerRe: DICOM TAGS Pin
Dave Kreskowiak26-Jun-22 6:13
mveDave Kreskowiak26-Jun-22 6:13 
QuestionDevelopment Pin
User 156237373-Jun-22 10:46
User 156237373-Jun-22 10:46 
AnswerRe: Development Pin
Gerry Schmitz4-Jun-22 10:35
mveGerry Schmitz4-Jun-22 10:35 
GeneralRe: Development Pin
User 156237376-Jun-22 4:22
User 156237376-Jun-22 4:22 
QuestionTreeView in ControlTemplate - Handling Item Expanded Pin
Kevin Marois27-Apr-22 9:46
professionalKevin Marois27-Apr-22 9:46 

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.