WPF Customise NavigationUI Control - wpf

Good Afternoon,
I am trying to customise the NavigationPanel UI Back and forward button, i basically just want to change the colors. I cannot find a property that can be set so i am a little stuck.
I believe the way forward is to amend an existing template and set the Page.Template property as the new control template? Am i going down the correct route? Where does this Xaml belong to, under the Application.Resources / Page.Resources?
I believe the Template is http://msdn.microsoft.com/en-us/library/aa970054.aspx
Apologies if this is a basic question but i am trying to learn Xaml / Wpf.
Thanks for your help in advance...

I found a good example of this under samples on Msdn:
The link:
http://code.msdn.microsoft.com/Customized-NavigationWindow-ced9d7af
I then used the default template as above and amended the xaml to the effect i wanted. Simple when you can find a sample. :-)

Related

Tag editing in a WPF TextBox

I want to implement a custom TextBox that will allow me to edit tags. Hotmail's "To" TextBox is the best example I can think of:
Also Facebook's "To" implements the same concept:
Oh yeah, and StackOverflow does it too to tag a question :)
Does anyone have some experience in building something like that in WPF? What would be the first steps that I should make?
I believe this Tokenizing control does most of what you're looking for:
http://blog.pixelingene.com/2010/10/tokenizing-control-convert-text-to-tokens/
I'd try the following:
implement a TagEditor, which has the functionality to edit a single Tag (based on an AutoComplete TextBox that is swapped with a TextBlock once an existing Tag has been recognized or editing is ended)
create an DataTemplate that uses the TagEditor
create an ItemsControl that utilizes the DataTemplate
that breaks it down to three challenges, of which only the first is a bit tricky, but solveable with the given keywords and stackoverflow ;-)

Silverlight - Highlight List<> of words/prhases within TextBox

I am new to Silverlight and have a requirement to highlight (or change font color) all words and phrases wtihin a TextBox that match a list of words/phrases. At first I though this would be easy, but the more I look into it, the more confused I get.
My goal is to write something reusable so I can also apply the logic to a RadGridView later. I've seen a few examples of stuff close to what I need, but it's beyond my Silverlight level at this point.
I want to write this myself to get a better understanding of how some of the Silverlight internals work. Can someone point me in the right direction of where to start on something like this? Should this be implemented in a control? Should I use a behavior? I'm using Silverlight 4.
Once I know where to start, I am sure I can get this done - with some help from you guys of course ;-)
Thanks,
-Scott
How about using the RadRichTextBox (I assume you have a licence for it as you mentionned the RadGridView)?
There's also a good sample project on Telerik forum that is doing exactly what you want to do.

Silverlight template selector solution works great, but not blend able

Before I begin here is a reference to how I implemented a template selector with Silverlight.
http://geekswithblogs.net/tkokke/archive/2009/09/28/datatemplateselector-in-silverlight.aspx
Everything works great. But the solution just doesn't work in blends making things more difficult to visualize overall. Is the correct work flow to just create a UserControl from the contents and embed it inside the Resource Dictionary to make it blendable, or is there a better way to do this?
Either way, I'm asking this question and posting the Template Selector solution at the same time, because I found it useful. Better solutions are very much welcome.
fyi.. sl4,.net4, latest blends.. all the new toys.. using mvvm light(little relevance).
I would recommend you go with the the following kind of implementation: DataTemplateSelector on CodeProject.
The drawback of the link you posted is that the location and name of the templates are hard-coded in the ContentControl's implementation. With the approach provided in the article I link to, the data templates are accessed in-line, or by regular {StaticResource} references (which means more flexibility), and on top of that, Blend knows what to do with that.

WPF - Which one is better? Style or User Control?

I wanted to know which one amongst Style and UserControl would be better to use in WPF?
For example:
I have created an image button in two different ways.
One uses Style and ContentTemplate property is set.
It uses one other class with dependency properties.
The other way is I have created a UserControl which has a button and its content property is set.
The file UserControl.xaml.cs also contains the dependency properties.
For Code details see the answers of this question:
Custom button template in WPF
Which one would be better to use? In which scenario should one go for Style or UserControl or any CustomControl?
Styles are limited to setting default properties on XAML elements. For example, when I set the BorderBrush , I can specify the brush but not the width of the border. For complete freedom of a control’s appearance, use templates. To do this, create a style and specify the Template property.
Styles and templates still only allow you to change the appearance of a control. To add behavior and other features, you’ll need to create a custom control.
For example,
To create a button like a play button use styles and templates, but to create a a play button which will change its appearance after pausing it use UserControl.
For this type of thing I would go with Style, even though I'm not really adept with graphical tools. I tend to produce a basic, boring style that I can get started with and then prettify it once the application functionality has been verified.
The nicest thing about WPF is being able to distance much of the graphical look, feel and behaviour away from the code.
This allows you to change the style of your application without revisiting the code and indeed means that you can change styles on the fly at runtime.
There is an awkward line to tread with regards to how much behaviour is placed within the XAML and how much is placed within the code. A rough guide would be to decide on what behaviour must always be present within the UI and place that in the code, everything else place within the XAML.
Think of the code as being an abstract class with defined interfaces and the XAML Styles as being classes based on that class and you'll get an idea of what I mean.
Conversely, I know that people who are far more adept at the GUI work prefer to put more functionality in the XAML and others who prefer the code side, because they find the GUI work slow or difficult.
When thought of that way you'll see that there's never really a right or wrong answer, just better solutions that suit your skills.

Styling WPF slider background

I'm trying to apply a specific style to a slider control and I'm having trouble figuring out what I need to do for the slider's background. What do I need to do to get something like this triangle to show in the background of my slider?
I initially thought I would define a GeometryDrawing and set something in the tickbar tag to it - but I can't find anything suitable.
This is what I'm looking for. Thanks for any ideas.
Slider background http://img16.imageshack.us/img16/690/slider.png
Check out my Intuipic project, which does something similar (only horizontally):
you need to investigate a bit more into styling and templatiting in wpf. I would expect the easiest way would be to define a Control Template but you 'might' be able to achieve this with just styling
Check out this page on msdn for starters. There is probably loads of other resources out there. Big sections on it in the book i'm reading at the moment - pro wpf in c# 2008
Sorry i'm not coming up with an example... you'd be better off doing a bit of background reading and then coming back with any specific issues.

Resources