Click here to Skip to main content
15,566,623 members
Home / Discussions / WPF
   

WPF

 
Questionediting a WPF DataGrid Pin
pitwi13-Nov-22 10:08
pitwi13-Nov-22 10:08 
AnswerRe: editing a WPF DataGrid Pin
Gerry Schmitz15-Nov-22 8:38
mveGerry Schmitz15-Nov-22 8:38 
QuestionCan I see the bounding box around WPF controls at runtime ? Pin
Maximilien27-Oct-22 4:16
Maximilien27-Oct-22 4:16 
AnswerRe: Can I see the bounding box around WPF controls at runtime ? Pin
Richard Deeming27-Oct-22 5:05
mveRichard Deeming27-Oct-22 5:05 
QuestionCustom drawing ToggleButton when checked Pin
Maximilien17-Oct-22 10:12
Maximilien17-Oct-22 10:12 
AnswerRe: Custom drawing ToggleButton when checked Pin
Gerry Schmitz17-Oct-22 11:11
mveGerry Schmitz17-Oct-22 11:11 
GeneralRe: Custom drawing ToggleButton when checked Pin
Maximilien24-Oct-22 3:48
Maximilien24-Oct-22 3:48 
QuestionReferencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 3:24
Maximilien5-Oct-22 3: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 6:29
mveRichard Deeming5-Oct-22 6:29 
GeneralRe: Referencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 8:14
Maximilien5-Oct-22 8:14 
GeneralRe: Referencing DrawingImage in a binding. Pin
Maximilien5-Oct-22 8:55
Maximilien5-Oct-22 8:55 
QuestionDesign Question Pin
Kevin Marois2-Oct-22 12:13
professionalKevin Marois2-Oct-22 12:13 
AnswerRe: Design Question Pin
Gerry Schmitz2-Oct-22 16:47
mveGerry Schmitz2-Oct-22 16:47 
QuestionLooking for a WPF control. Pin
Maximilien22-Sep-22 9:40
Maximilien22-Sep-22 9:40 
AnswerRe: Looking for a WPF control. Pin
Richard Deeming22-Sep-22 22:39
mveRichard Deeming22-Sep-22 22:39 
GeneralRe: Looking for a WPF control. Pin
Maximilien23-Sep-22 2:33
Maximilien23-Sep-22 2:33 
GeneralRe: Looking for a WPF control. Pin
Maximilien23-Sep-22 2:54
Maximilien23-Sep-22 2:54 
QuestionWeird behavior with contextual menu not rendering properly. Pin
Maximilien21-Sep-22 8:00
Maximilien21-Sep-22 8:00 
AnswerRe: Weird behavior with contextual menu not rendering properly. Pin
Richard Deeming21-Sep-22 22:36
mveRichard Deeming21-Sep-22 22:36 
GeneralRe: Weird behavior with contextual menu not rendering properly. Pin
Maximilien22-Sep-22 9:22
Maximilien22-Sep-22 9:22 
QuestionConversion to .Net Core Issues Pin
Kevin Marois19-Sep-22 7:39
professionalKevin Marois19-Sep-22 7:39 
AnswerRe: Conversion to .Net Core Issues Pin
Richard Deeming19-Sep-22 22:20
mveRichard Deeming19-Sep-22 22:20 
GeneralRe: Conversion to .Net Core Issues Pin
Kevin Marois20-Sep-22 8:10
professionalKevin Marois20-Sep-22 8:10 
GeneralRe: Conversion to .Net Core Issues Pin
Kevin Marois22-Sep-22 6:57
professionalKevin Marois22-Sep-22 6:57 
GeneralRe: Conversion to .Net Core Issues Pin
Richard Deeming22-Sep-22 22:38
mveRichard Deeming22-Sep-22 22: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.