Click here to Skip to main content
13,189,884 members (50,039 online)

Silverlight / WPF

 
AnswerRe: WPF Tab Item Close Button Pin
SledgeHammer0129-Jan-13 19:02
memberSledgeHammer0129-Jan-13 19:02 
GeneralRe: WPF Tab Item Close Button Pin
Kevin Marois2-Feb-13 15:33
memberKevin Marois2-Feb-13 15:33 
GeneralRe: WPF Tab Item Close Button Pin
SledgeHammer012-Feb-13 18:25
memberSledgeHammer012-Feb-13 18:25 
QuestionCustom Control Template for beginners Pin
jeffdavis870329-Jan-13 9:12
memberjeffdavis870329-Jan-13 9:12 
I am new to WPF applications. I come from a VB6 Windows Forms background. I used to create user controls that I used in UI's to create graphic content controls like buttons with normal, down,and hover images. While I know the ultimate way to do this is create a separate project for my custom controls I am just working withing a single project to get things worked out first.

I have created a Controls folder where I have added several custom controls each inherting from a base control like Button, RadioButton, Slider, Checkbox etc. I can then add properties to each custom control for DefaultImage, DownImage, HoverImage and in the case of a Slider GripImage and GutterImage. The properties have a public set/get property so I can set the images for a specific control and then the control behavior can set the proper image.

There is an Images folder where I put all the images needed for the application.

I have created a Images.xaml ResourceDictionary that defines key names like ButtonDown to the specific image names so the image naming in the template is easier and I can swap out images easily.

A Generic.xaml gets created in the Themes folder where the basic Control Template goes. Not sure if this is best practice for storing each Control Template or not but it is what gets created by default.

My main area of difficulty is creating the template. I know what I want to do but can't get the syntax to work correctly.

In the case of the custom button I want to create triggers for IsPressed and IsMouseOver and set the controls Background ImageBrush to the proper image. When those triggers are false I want to set the background image to the DefaultImage

I'm not sure about the syntax for refering to the image property of the custom Control and how best to access it in the xamal.

I've looked at a lot of examples but none seem to do things the way I am organizing it. I don't want to hard code the images to the control. My ultimate goal is to be able to drag the custom control into a grid using the designer and set the Default, Down, and Hover image properties and then place the control how I want it in the designer. Then if I want to change the entire look of the app I can just swap out images in the Images folder and the GUI will change.
AnswerRe: Custom Control Template for beginners Pin
SledgeHammer0129-Jan-13 11:32
memberSledgeHammer0129-Jan-13 11:32 
GeneralRe: Custom Control Template for beginners Pin
jeffdavis870329-Jan-13 12:10
memberjeffdavis870329-Jan-13 12:10 
GeneralRe: Custom Control Template for beginners Pin
SledgeHammer0129-Jan-13 12:46
memberSledgeHammer0129-Jan-13 12:46 
GeneralTreeview Selection Pin
vijilvs11628-Jan-13 23:03
membervijilvs11628-Jan-13 23:03 
QuestionProblem With TreeViewItem Tooltip Pin
Kevin Marois26-Jan-13 15:39
memberKevin Marois26-Jan-13 15:39 
GeneralRe: Problem With TreeViewItem Tooltip Pin
Thomas Duwe29-Jan-13 1:46
memberThomas Duwe29-Jan-13 1:46 

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.


Advertise | Privacy |
Web03 | 2.8.171016.2 | Last Updated 14 Oct 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid