Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6545509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:35:39+00:00 2026-05-25T11:35:39+00:00

Hi how can I set the property of a control placed inside a controltemplate.

  • 0

Hi how can I set the property of a control placed inside a controltemplate. Here is my code:

                    <dg:DataGrid Name="questionList"
                             HeadersVisibility="None"
                             AutoGenerateColumns="False"
                             Background="White"
                             Margin="42,32,43,0"
                             BorderThickness="0" 
                             GridLinesVisibility="None"
                             CanUserAddRows="False" 
                             HorizontalGridLinesBrush="#FFCCCCCC" 
                             Cursor="Hand" 
                             MaxHeight="483"
                             FocusVisualStyle="{x:Null}"
                             PreviewMouseLeftButtonUp="questionnaireList_PreviewMouseLeftButtonUp" 
                             CanUserReorderColumns="False" 
                             CanUserResizeColumns="False" 
                             CanUserSortColumns="False" 
                             HorizontalScrollBarVisibility="Hidden"
                             SelectionMode="Single">
                    <dg:DataGrid.CellStyle>
                        <Style TargetType="{x:Type dg:DataGridCell}">
                            <Setter Property="BorderThickness" Value="0"/>
                            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                        </Style>
                    </dg:DataGrid.CellStyle>
                    <dg:DataGrid.RowStyle>
                        <Style TargetType="{x:Type dg:DataGridRow}">
                            <Setter Property="Background" Value="{Binding QuestionImage, Converter={x:Static my:StatusColorConverter.instance}}" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type dg:DataGridRow}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                                BorderThickness="{TemplateBinding BorderThickness}" 
                                                Background="{TemplateBinding Background}" 
                                                SnapsToDevicePixels="True">
                                            <dg:SelectiveScrollingGrid>
                                                <dg:SelectiveScrollingGrid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </dg:SelectiveScrollingGrid.ColumnDefinitions>
                                                <dg:SelectiveScrollingGrid.RowDefinitions>
                                                    <RowDefinition Height="*"/>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                </dg:SelectiveScrollingGrid.RowDefinitions>
                                                <dg:DataGridCellsPresenter Grid.Column="1" 
                                                                           ItemsPanel="{TemplateBinding ItemsPanel}" 
                                                                           SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                <Path Grid.Row="2" Grid.ColumnSpan="2"
                                                                   Data="M0,0.5 L1,0.5"
                                                                   Stretch="Fill" 
                                                                   Stroke="#FFCCCCCC" 
                                                                   StrokeThickness="1"
                                                                   StrokeDashArray="1.0 2.0"/>
                                                <Button Style="{DynamicResource btnSubmitStyle}" 
                                                        Width="106" 
                                                        Height="47" 
                                                        Name="btnSubmit"
                                                        Margin="0,13,0,13" 
                                                        Click="btnSubmit_Click" 
                                                        Visibility="Hidden" 
                                                        Grid.Column="3"
                                                        Cursor="Hand">
                                                            <StackPanel Orientation="Horizontal" 
                                                                        HorizontalAlignment="Center" 
                                                                        VerticalAlignment="Center">
                                                                <Image Source="/iQuestionnaire;component/Images/arrow.png" Width="17" Height="16" />
                                                                <TextBlock Margin="5,0,0,0" 
                                                                           FontSize="16" 
                                                                           Width="Auto"
                                                                           Text="Submit"/>
                                                            </StackPanel>
                                                </Button>
                                            </dg:SelectiveScrollingGrid>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                        </Style>
                    </dg:DataGrid.RowStyle>
                    <dg:DataGrid.Columns>
                        <dg:DataGridTemplateColumn Width="69*">
                            <dg:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Margin="12,16,0,17" 
                                               FontSize="20" 
                                               Foreground="#0891F1" 
                                               Text="{Binding Path=QuestionNum}" 
                                               TextWrapping="Wrap"/>
                                </DataTemplate>
                            </dg:DataGridTemplateColumn.CellTemplate>
                        </dg:DataGridTemplateColumn>
                        <dg:DataGridTemplateColumn Width="601*">
                            <dg:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <TextBlock FontSize="14" 
                                               Foreground="#666666"
                                               Text="{Binding Path=QuestionDesc}"
                                               TextWrapping="Wrap"
                                               TextAlignment="Justify"
                                               Margin="0,16,0,17" />
                                    </Grid>
                                </DataTemplate>
                            </dg:DataGridTemplateColumn.CellTemplate>
                        </dg:DataGridTemplateColumn>
                        <dg:DataGridTemplateColumn Width="117*">
                            <dg:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Image Source="{Binding Path=QuestionImage}" 
                                           Stretch="None" 
                                           VerticalAlignment="Top" 
                                           HorizontalAlignment="Right" 
                                           Margin="0,16,18,17" />
                                </DataTemplate>
                            </dg:DataGridTemplateColumn.CellTemplate>
                        </dg:DataGridTemplateColumn>
                    </dg:DataGrid.Columns>
                </dg:DataGrid>

I want to set the Visibility property of the “btnSubmit” button at run time. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:35:40+00:00Added an answer on May 25, 2026 at 11:35 am

    You can bind the Visibility of the ‘btnSubmit’ using BooleanToVisibilityConverter.

    Just add to Resources:

    <local:BooleanToVisibilityConverter x:Key="b2vconv" IsReversed="false"/>
    

    then use:

     Visibility="{Binding Path=yourDataSourceColumnWithBoolValueForVisibility, 
                          Converter={StaticResource b2vconv} }"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I have the property of a property set using NHibernate? Here is
I have 16 bits. In each bit I can set some property and send
any property can set the pin in google map bigger? from what i know,
Can I set the attributedText property of a UILabel object? I tried the below
How can I set the selectedvalue property of a SelectList after it was instantiated
I wrote an attached property that I can set on a window to extend
How can i set the handle needed property for a form in firemonkey. In
The background-position property can be set in a variety of ways such as top
How can I set a string to when using an auto-implemented property like: public
Actually Datalist not contain allowpaging property. so how can i set paging in datalist.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.