Public static T FindVisualChildByName{This works for the Visual elements, not for the current elements of a parent: http://forums.silverlight.net/forums/p/85766/402922.aspx
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var child = VisualTreeHelper.GetChild(parent, i);
string controlName = child.GetValue(Control.NameProperty) as string;
if (controlName == name)
{
return child as T;
}
else
{
T result = FindVisualChildByName
if (result != null)
return result;
}
}
return null;
}
Ref:
http://flatlinerdoa.spaces.live.com/Blog/cns!17124D03A9A052B0!566.entry
http://blogs.msdn.com/kmahone/archive/2009/03/29/visualtreehelper.aspx
http://enterpriseetc.com/post/VisualTreeHelper-Class-in-Silverlight.aspx
mercredi 28 avril 2010
Find a control in a WPF/Silverlight by name
mercredi 21 avril 2010
SL Custom Controls
http://msdn.microsoft.com/en-us/magazine/cc721611.aspx#id0430049
Step 1: Create a New Silverlight Project
Step 2: Derive from Control (or ContentControl)
Step 3: Create a Control Template
Step 4: Create a Default Control Template
Step 5: Add Template Bindings
Step 6: Replace TextBlock with ContentPresenter
Step 7: Add a Click Event
Step 8: Add Visual States
The Completed Control
Silverlight: Refresh DataGrid
http://stackoverflow.com/questions/1826593/silverlight-3-how-to-refresh-a-datagrid-content
vendredi 5 mars 2010
Silverlight 3: Copier Coller du texte
La version 3 de SL ne permet pas d'avoir le menu contextuel habituel en faisant un click droit, donc pas possible de faire du copier/coller avec click droit.. en effet, le click droit sera géré dans Silverlight 4.
Cet article présente une solution pour contourner le problème :
http://geekswithblogs.net/bdiaz/archive/2010/03/01/a-simple-selectable-silverlight-textblock-sort-of.aspx
mardi 23 février 2010
mercredi 10 février 2010
A new age
After several months in a crapy mission with self absorbed people, I'm glad to have this new start in a new Silverlight 3 project. This might sound dumb, but it's so releaving to see that the people you're dealing with are more into their job and more interested into going forward than in their ego and doing everything to look better than anyone, while they actually suck !
I'm creating styles for SL3 controls, and probably will turn to creating custom controls. It's really exciting to work on new stuff, pull your hair out to fix and solve things ! the work load and late hours don't matter anymore, you're into it and glad to be ! It feels alive !
I've been making a mistake thinking i don't need Expression Blend, but it turned out to be a very interesting and powerful tool, not meant only for designers, but also for developpers.
I'll try and post new things about styles in SL within the next weeks.
This is only the start, and hopefully this will last for very long !