mardi 19 juillet 2016

Checkbox that doesn't render when clicked WPF

I'm looking for this behavior:

<Button Command="{Binding Path=CreateButtonCommand}">
    <Button.Content>
        <CheckBox Content="{Binding Path=Name}"  IsHitTestVisible="false" 
                  IsChecked="{Binding Path=IsChecked, Mode=OneWay}"/>
    </Button.Content>
</Button>

But I want this look:

<Button Command="{Binding Path=CreateButtonCommand}">
    <Button.Content>
        <CheckBox Content="{Binding Path=Name}"  IsHitTestVisible="false" 
                  IsChecked="{Binding Path=IsChecked, Mode=OneWay}"/>
     </Button.Content>
     <Button.Template>
        <ControlTemplate TargetType="Button">
            <ContentPresenter />
        </ControlTemplate>
     </Button.Template>
</Button>

I'm after making a CheckBox that doesn't render the check when you click it, the reason for the button, because I want it where the user clicks, then View Model do some work and if everything is ok, then it will update the IsChecked flag for the Checkbox.




Aucun commentaire:

Enregistrer un commentaire