Click here to Skip to main content
15,899,754 members
Home / Discussions / WPF
   

WPF

 
QuestionDisable ComboBox Hyperlinks Pin
Kevin Marois19-Aug-21 12:43
professionalKevin Marois19-Aug-21 12:43 
Overview
I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks.

Problem
I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this.

Here is a screenshot of the grid

and here's the XAML
<DataGridTemplateColumn Header="Actions" 
                        Width="220">

<pre>
<DataGridTemplateColumn.CellTemplate>

    <DataTemplate>

        <ComboBox Grid.Row="0"
                    Grid.Column="1"
                    ItemsSource="{Binding Source={StaticResource actions}}"
                    Style="{StaticResource comboBoxStyle}"
                    IsEnabled="True"
                    Width="200"
                    Margin="2">

            <ComboBox.ItemTemplate>
                <DataTemplate>

                    <TextBlock>

                        <Hyperlink Style="{StaticResource HyperlinkStyle}">

                            <TextBlock Text="{Binding Converter={StaticResource enumDescConverter}}"
                                        FontSize="14"/>

                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <i:InvokeCommandAction Command="{Binding ElementName=dispatchControl, Path=DataContext.ExecuteActionCommand}"
                                                                CommandParameter="{Binding}"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>

                        </Hyperlink>

                    </TextBlock>

                </DataTemplate>

            </ComboBox.ItemTemplate>

        </ComboBox>

    </DataTemplate>

</DataGridTemplateColumn.CellTemplate>



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

AnswerRe: Disable ComboBox Hyperlinks Pin
Richard Deeming19-Aug-21 21:35
mveRichard Deeming19-Aug-21 21:35 
GeneralRe: Disable ComboBox Hyperlinks Pin
Kevin Marois20-Aug-21 4:36
professionalKevin Marois20-Aug-21 4:36 
AnswerRe: Disable ComboBox Hyperlinks Pin
Matt T Heffron25-Aug-21 11:08
professionalMatt T Heffron25-Aug-21 11:08 
QuestionWPF DataGrid - Stretch Row Details Vertically Pin
Kevin Marois29-Jul-21 7:39
professionalKevin Marois29-Jul-21 7:39 
QuestionGet MainWindow from Executing Assembly Pin
Kevin Marois23-Jul-21 8:59
professionalKevin Marois23-Jul-21 8:59 
AnswerRe: Get MainWindow from Executing Assembly Pin
Richard Deeming27-Jul-21 23:18
mveRichard Deeming27-Jul-21 23:18 
GeneralRe: Get MainWindow from Executing Assembly Pin
Kevin Marois28-Jul-21 10:04
professionalKevin Marois28-Jul-21 10:04 
GeneralCan anyone recommend a free WPF editor control? Pin
Mike Hankey23-Jul-21 4:25
mveMike Hankey23-Jul-21 4:25 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 4:39
professionalSlacker00723-Jul-21 4:39 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Richard Andrew x6423-Jul-21 4:45
professionalRichard Andrew x6423-Jul-21 4:45 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Mike Hankey23-Jul-21 4:50
mveMike Hankey23-Jul-21 4:50 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 5:01
professionalSlacker00723-Jul-21 5:01 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Richard Deeming27-Jul-21 23:16
mveRichard Deeming27-Jul-21 23:16 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Mike Hankey28-Jul-21 2:05
mveMike Hankey28-Jul-21 2:05 
QuestionInstalling Test Mode vs Production Mode Pin
Kevin Marois19-Jul-21 8:55
professionalKevin Marois19-Jul-21 8:55 
QuestionRouted Event Args Null Pin
Kevin Marois28-Jun-21 16:28
professionalKevin Marois28-Jun-21 16:28 
AnswerRe: Routed Event Args Null Pin
Richard Deeming28-Jun-21 22:34
mveRichard Deeming28-Jun-21 22:34 
QuestionHow to change background color in combobox in code behind? Pin
Cường Nguyễn Văn 202123-Jun-21 6:56
Cường Nguyễn Văn 202123-Jun-21 6:56 
QuestionMake textbox fill up and resizie Pin
Acuena21-Jun-21 20:59
Acuena21-Jun-21 20:59 
AnswerRe: Make textbox fill up and resizie Pin
Richard Deeming21-Jun-21 21:58
mveRichard Deeming21-Jun-21 21:58 
AnswerRe: Make textbox fill up and resizie Pin
Gerry Schmitz22-Jun-21 7:07
mveGerry Schmitz22-Jun-21 7:07 
Question[Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai18-Jun-21 7:34
Oscar Tsai18-Jun-21 7:34 
AnswerRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Gerry Schmitz19-Jun-21 14:29
mveGerry Schmitz19-Jun-21 14:29 
GeneralRe: [Problem] Why can not Pass Image between 2 Views by using the same ViewModel (MVVM) Pin
Oscar Tsai20-Jun-21 3:20
Oscar Tsai20-Jun-21 3:20 

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.