How to configure the HubTile control width in Xaml - silverlight

I'm trying to set the size of the a HubTile control from the Silverlight toolkit, but it always use the default size of 173.
There is anyway that can be used to change this property ??
Thanks,
Georges Benatti Jr

Since this is is a Q&A site, I'll try to be helpful.
To do what you want, you need to change the style and visual states and transitions like joseharriaga suggested. Since you obviously do need it, I suggest you take a look at my blog post in which I covered that scenario, and even gave a link to the HubTile styling example that changed it's size to 300x300.
http://igrali.wordpress.com/2011/08/19/how-to-use-the-hubtile-control/
You can change it to whatever you like from there.
Regards

I'm not sure if this is possible but you have the sourcecode and you could use some styling, but remember to make sure it fits in the metro ui. It has this default size so it fits to the whole look and feel of the phone. Changing this might make it more difficult for the user to navigate your app. Sorry i can't help you more specific at the moment. I'm on the go.

Changing the size of a HubTile to something else than it's default 173 x 173 size is not supported.
That was done to be Metro-compliant, so that it matches the original user experience.
Still, you can get the source code and modify the 173 values in the Control Template, Visual States and Visual Transitions to the value you're looking for, but I would only do this if I really need the tile to be sized differently and there's no way around it.
Ideally, I'd stick to the default size, so that my app looks like it's a native app, making it feel part of the phone itself.

Related

Drawing app - the easiest design

Well, I'm a newbie. I'd like to write an app in WPF. The main purpouse will be in drawing predefined elements/objects. Input from user is mostly realized by text boxes - numbers. But I'd like to add some kind of user input into drawing itself too + zooming and moving. Next functionality will be in saving the draw for later loading and another editing (printing maybe, but it's far far away).
I can imagine something like this:
due to some user interaction I'd prefere to use of InkCanvas
i want to define my own elements/objects with some properties. But where it will be define? Some external file maybe?
the save file will be composed of XAML code only
I will study this more lately, but I want to know if my thoughts are in the right way.
Are these points correct, or completely bullshit? :)
Thanks, and sorry for English...
I don't know if this is exactly what are you looking for, but here a little list of advice to help you on reaching your goal:
First of all, if you are crating an application, you should see this before. It explain the Model-View-ViewModel pattern, which is essential when you are creating something on WPF. This can help you abount your 2nd point.
Regarding your save file, i don't know exactly what you have in mind, but it depends on what do you want to save exactly. If you want, InkCanvas have the option to export directly the work in a bitmap . If you need to store some setting, depending on your need you can work with Settings or Resources
InkCanvas seems the appropriate tool for your need. Of course you will have to build your app around this control

MFC: how to render an Aero-style combo box for owner draw?

I have inherited a large MFC application which contains a CComboBox subclass that overrides OnPaint. Currently it does all its drawing by hand (with lines and rectangles), and renders a combo box that looks decidedly Windows 98-style. However, it otherwise works great and provides a lot of useful custom functionality that we rely on, and rewriting the entire control is probably not an option.
I would like to modernize it so that the OnPaint draws in Aero style where available (falling back to the old code when modern theming is unavailable). I've done this with some other custom controls we have, like buttons, and it works great for our purposes. I know there are some tiny behaviors that it won't get right, like gentle highlights on mouse-hover, but that's not a big deal for this app.
I have access to the CVisualStylesXP ckass, so I've already got the infrastructure to make calls like OpenThemeData, GetThemeColor or DrawThemeBackground pretty easily (via LoadLibrary so we don't force Vista as a min-system). Unfortunately, I don't know the proper sequence of calls to get a nice looking combo box with the theme-appropriate border and drop-down button.
Anyone know what to do here?
Honestly, I don't know why they originally tried to override OnPaint. Is there a good reason? I'm thinking that at least 99% of the time you are just going to want to override the drawing of the items in the ComboBox. For that, you can override DrawItem, MeasureItem, and CompareItem in a derived combo box to get the functionality you want. In that case, the OS will draw the non-user content specific to each OS correctly.
I think you best shot without diving in the depth of xp theming and various system metrics is take a look at this project: http://www.codeproject.com/Articles/2584/AdvComboBox-Version-2-1
Check the OnPaint of the CAdvComboBox class - there is a full implementation of the control repainting including xp theme related issues.
Not sure if it's the same situation - but when I faced this problem (in my case with subclassed CButtons), solving it only required changing the control declaration to a pointer and creating the control dynamically.
Let's assume that your subclassed control is called CComboBoxExt.
Where you had
CComboBoxExt m_cComboBoxExt;
You'll now have
CComboBoxExt* m_pcComboBoxExt;
And on the OnInitDialog of the window where the control is placed, you create it using
m_pcComboBoxExt = new CComboBoxExt();
m_pcComboBoxExt->Create(...)
Since this is now a pointer, don't forget to call DestroyWindow() and delete the pointer on termination.
This solved my particular problem - if your control is declared in the same way, consider giving it a try.

Experiences with Xaml Styler?

I just found Xaml Styler and I'd like to give it a try. Can anyone share some experiences with this tool? Is it worth the try? Are there any drawbacks when using it in large teams?
Thanks!
I'm using it daily, and it's quite awesome. It's more than definitively worth a try, and I don't see any drawbacks.
Just make sure that everybody have the same settings, if you choose to divert from the default ones.
I absolutely love the XAML Styler. Though source control issues do happen. If you beautify a XAML document that can mean 1800 lines change if it was really ugly when you did it. If members of your team also have it checked out then they have to resolve 1800 lines of changes. So I recommend you be careful about when and which files you do this with in a team environment.
Trick: It beautifies the XAML page when that is the current tab and you hit [SAVE].
If you don't want the page beautified, then switch to a different tab and choose [SAVE ALL].
This is what I do when other team members have the same document checked out. If I'm the only one, then I do a normal save to make it nice, then check it in ASAP.
After using this tool for some time, I have to say that I don't recommend it because:
Attribute Definition Order Matters, and therefore the behavior might be altered when a XAML page is "beautified". The tool does not offer a setting to exclude attribute sorting. Here's more information on this problem: Silverlight XAML Attribute Definition Order Matters
Source control conflicts are actually a pain and there's no way to "force" the team members to use the tool. It would be nice for example, that the XAML files where styled when saving the file.
Hope it helps someone!
I started using this tool recently-- and I'm a big fan-- but one thing was really annoying me: it automatically formats everything whenever you hit save. I like using the green edit markup next to the line numbers in VS to keep track of where I am in big files. Whenever I hit save, it turns the whole file green.
So protip, if you turn off "Format XAML on save" in Tools>Options>XAML Styler, you can just right click on a file and hit format when you don't need your edit markup anymore.

Is the winform 'size' property localizable in any way?

I'm in the process of writing a set of documents to help other developers in our office localize various components of a large application. I'm using a tool called Globalizer.NET to do the donkey work and it's very good as it even lets you localize the size and position properties of controls to allow for the likely changes in length of text strings once translated. However, it occurred to me that in some cases I might need to re-size the entire form a bit, but Globalizer doesn't let you do this, and I cannot see any other way of doing this. I have even tried manually adding an entry in the language specific resource file for the form size but it doesn't make any difference.
Ultimately, once it has become a little more established, we'd consider moving to WPF which I understand makes this easier, but for now we can't for a number of reasons.
Is there any way at all to localize this property of a winform? I am beginning to suspect not, but figured I'd ask in case someone else has come up with a workaround.
Don't worry - about a moment after posting this I had a bit of a Homer moment and realised I was trying to use the wrong property - ClientSize is a perfectly localizable property!
Thanks for reading.
Steve

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.

Resources