Click here to Skip to main content
15,877,757 members
Home / Discussions / WPF
   

WPF

 
Questionediting a WPF DataGrid Pin
pitwi13-Nov-22 9:08
pitwi13-Nov-22 9:08 
AnswerRe: editing a WPF DataGrid Pin
Gerry Schmitz15-Nov-22 7:38
mveGerry Schmitz15-Nov-22 7:38 
QuestionCan I see the bounding box around WPF controls at runtime ? Pin
Maximilien27-Oct-22 3:16
Maximilien27-Oct-22 3:16 
AnswerRe: Can I see the bounding box around WPF controls at runtime ? Pin
Richard Deeming27-Oct-22 4:05
mveRichard Deeming27-Oct-22 4:05 
QuestionCustom drawing ToggleButton when checked Pin
Maximilien17-Oct-22 9:12
Maximilien17-Oct-22 9:12 
AnswerRe: Custom drawing ToggleButton when checked Pin
Gerry Schmitz17-Oct-22 10:11
mveGerry Schmitz17-Oct-22 10:11 
GeneralRe: Custom drawing ToggleButton when checked Pin
Maximilien24-Oct-22 2:48
Maximilien24-Oct-22 2:48 
QuestionReferencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 2:24
Maximilien5-Oct-22 2:24 
I'm not certain what I have to google for.

I have Drawing images in an resource file like this :
<DrawingImage x:Key="FindIcon"/>
<DrawingImage x:Key="SearchIcon"/>

I can use them like this :
<Image Source="{StaticResource FindIcon}"/>
<Image Source="{StaticResource SearchIcon}"/>

Now, I want to be able to bind the image source and conditionally choose the image in the Code-Behind.
<Image Source="{Binding ChooseIcon}"/>

I'm not certain how I reference the image in the code ?

Is this a DrawingImage ? How do I load it in the code ?
public DrawingImage ChooseIcon
{
    get
    {
        if (useFindIcon)
        {
            return ???; // how to reference the static resource "FindIcon"
        }
        else if (useSearchIcon)
        {
            return ???;// how to reference the static resource "SearchIcon"
        }
    }
}

Thanks.
Max.
CI/CD = Continuous Impediment/Continuous Despair

AnswerRe: Referencing DrawingImage in a binding. Pin
Richard Deeming5-Oct-22 5:29
mveRichard Deeming5-Oct-22 5:29 
GeneralRe: Referencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 7:14
Maximilien5-Oct-22 7:14 
GeneralRe: Referencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 7:55
Maximilien5-Oct-22 7:55 
QuestionDesign Question Pin
Kevin Marois2-Oct-22 11:13
professionalKevin Marois2-Oct-22 11:13 
AnswerRe: Design Question Pin
Gerry Schmitz2-Oct-22 15:47
mveGerry Schmitz2-Oct-22 15:47 
QuestionLooking for a WPF control. Pin
Maximilien22-Sep-22 8:40
Maximilien22-Sep-22 8:40 
AnswerRe: Looking for a WPF control. Pin
Richard Deeming22-Sep-22 21:39
mveRichard Deeming22-Sep-22 21:39 
GeneralRe: Looking for a WPF control. Pin
Maximilien23-Sep-22 1:33
Maximilien23-Sep-22 1:33 
GeneralRe: Looking for a WPF control. Pin
Maximilien23-Sep-22 1:54
Maximilien23-Sep-22 1:54 
QuestionWeird behavior with contextual menu not rendering properly. Pin
Maximilien21-Sep-22 7:00
Maximilien21-Sep-22 7:00 
AnswerRe: Weird behavior with contextual menu not rendering properly. Pin
Richard Deeming21-Sep-22 21:36
mveRichard Deeming21-Sep-22 21:36 
GeneralRe: Weird behavior with contextual menu not rendering properly. Pin
Maximilien22-Sep-22 8:22
Maximilien22-Sep-22 8:22 
QuestionConversion to .Net Core Issues Pin
Kevin Marois19-Sep-22 6:39
professionalKevin Marois19-Sep-22 6:39 
AnswerRe: Conversion to .Net Core Issues Pin
Richard Deeming19-Sep-22 21:20
mveRichard Deeming19-Sep-22 21:20 
GeneralRe: Conversion to .Net Core Issues Pin
Kevin Marois20-Sep-22 7:10
professionalKevin Marois20-Sep-22 7:10 
GeneralRe: Conversion to .Net Core Issues Pin
Kevin Marois22-Sep-22 5:57
professionalKevin Marois22-Sep-22 5:57 
GeneralRe: Conversion to .Net Core Issues Pin
Richard Deeming22-Sep-22 21:38
mveRichard Deeming22-Sep-22 21:38 

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.