Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello thereWhen I click on checkbox, I want the textbox to appear and enter the value.
Or when I remove the checkbox, I want the department checkboxes to come as a list at the bottom. But the textbox always comes with the checkbox.

For example:

AllDepartment is checked --->Textbox show.

AllDepartment is not checked ----> Show Open other checkbox list(Healthy checkbox,Banking checkbox, ...vs) and textbox show.

What I have tried:

xmal

<GroupBox x:Name="groupBox" Header="Page" HorizontalAlignment="Left" Height="300" VerticalAlignment="Top" Width="782" Margin="-9,0,0,0">

        <StackPanel Orientation="Vertical" VerticalAlignment="Top">
            <StackPanel Orientation="Horizontal">
                <CheckBox x:Name="Department" Content="All Department" IsChecked="{Binding AllDepartmentCheck}"></CheckBox>
                <TextBox  Text="{Binding AllDeparmentCount}" Visibility="{Binding allDepartmentVisibility}"/>
            </StackPanel>
            <Button x:Name="button" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/>
        </StackPanel>
    </GroupBox>




CS.
public bool AllDepartmentCheck
{
    get { return allDepartmentCheck; }
    set
    { 
        allDepartmentCheck = value; 
        allDepartmentCheck = ( allDepartmentCheck != null );
        OnPropertyChanged("allDepartmentCheck");
    }
}



public void Add()
{
//this adding function code.
}
Posted
Updated 25-Aug-19 2:52am
v2
Comments
OriginalGriff 25-Aug-19 5:59am    
And?
What have you tried?
Where are you stuck?
What help do you need?

Use the "Improve question" widget to edit your question and provide better information.

1 solution

C#
public Visibility allDepartmentVisibility {
   get { return allDepartmentCheck ? Visibility.Visible : Visibility.Hidden; } 
}

...

OnPropertyChanged("allDepartmentCheck");
OnPropertyChanged( nameof(allDepartmentVisibility) );
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900