Click here to Skip to main content
15,886,199 members
Home / Discussions / WPF
   

WPF

 
QuestionDynamically creating controls in WPF/MVV Pin
Ashfaque Hussain15-Jul-14 20:20
Ashfaque Hussain15-Jul-14 20:20 
AnswerRe: Dynamically creating controls in WPF/MVV Pin
Richard MacCutchan15-Jul-14 22:13
mveRichard MacCutchan15-Jul-14 22:13 
GeneralRe: Dynamically creating controls in WPF/MVV Pin
Ashfaque Hussain16-Jul-14 2:05
Ashfaque Hussain16-Jul-14 2:05 
SuggestionRe: Dynamically creating controls in WPF/MVV Pin
Richard MacCutchan16-Jul-14 2:25
mveRichard MacCutchan16-Jul-14 2:25 
Questionhow this code works and why tag is used Pin
anil42010-Jul-14 22:57
anil42010-Jul-14 22:57 
AnswerRe: how this code works and why tag is used Pin
simbos10-Jul-14 23:28
simbos10-Jul-14 23:28 
SuggestionRe: hello Pin
Richard MacCutchan10-Jul-14 22:34
mveRichard MacCutchan10-Jul-14 22:34 
QuestionConfused about MarkupExtension class reference in XAML Pin
Mc_Topaz9-Jul-14 3:38
Mc_Topaz9-Jul-14 3:38 
Hi!

I have read along with this article [^]regarding WPF applications with Markup extensions.
In the end of the article there is the section called Custom Markup Extension example which I have tried and got working. The XAML code for the example confuse me.

In the articles C# code there is the ReflectionExtension class
C#
public class ReflectionExtension : MarkupExtension
{
    ...
}


But in the XAML code there is no reference to ReflectionExtension instead there is a refence to Reflection.
XML
<ListBox ItemsSource="{local:Reflection {x:Type Grid}, 
       IncludeMethods=true, IncludeFields=true, IncludeEvents=true}" 
         MaxHeight="200" Grid.Row="3" Grid.ColumnSpan="2" />


I cannot find any reference what so ever in the article for Reflection, but somehow the example manage to reference to ReflectionExtension, compile and run.

If I rename the ReflectionExtension to MagicClass I must re-build the entire solution and change the XAML to:
XML
<ListBox ItemsSource="{local:MagicClass{x:Type Grid}, 
       IncludeMethods=true, IncludeFields=true, IncludeEvents=true}" 
         MaxHeight="200" Grid.Row="3" Grid.ColumnSpan="2" />

...or else the solution will not compile.

Is there a simple explanation for this?


I also have a further question regarding Markup Extensions.

In my company we have a language project which have classes deriving the MarkupExtension class. This gives the possibility in design time of XAML to
show different language text for buttons, labels and whatever other UIElement control that can display a text. The interesting is that I can switch language while in design-time and the XAML automatically display the selected language's text.

Unfortunately I cannot give away a example of this source code and might give me an explain how this works, but the XAML code I use is this:
XML
<Button Content="{l:Lang Key=20}" \>

The "l" is the namespace reference xmlns:l="clr-namespace:namespace;assembly=assembly".

The "lang" must be a reference to a class deriving the MarkupExtension class. But I have search in the entire project for "lang" and cannot find ANY reference to it what so ever. D'Oh! | :doh: Confused | :confused:

The "Key=20" is a reference to a the current language file with indices. In the my example there must be an index with value 20 which contain some text for whatever language is selected.

Without having the source code, can someone explain this?


Best regards,
/Steffe
AnswerRe: Confused about MarkupExtension class reference in XAML Pin
Pete O'Hanlon9-Jul-14 4:45
mvePete O'Hanlon9-Jul-14 4:45 
QuestionRe: Confused about MarkupExtension class reference in XAML Pin
Mc_Topaz9-Jul-14 5:34
Mc_Topaz9-Jul-14 5:34 
AnswerRe: Confused about MarkupExtension class reference in XAML Pin
Pete O'Hanlon9-Jul-14 5:55
mvePete O'Hanlon9-Jul-14 5:55 
GeneralRe: Confused about MarkupExtension class reference in XAML Pin
Richard Deeming9-Jul-14 8:01
mveRichard Deeming9-Jul-14 8:01 
GeneralRe: Confused about MarkupExtension class reference in XAML Pin
Pete O'Hanlon9-Jul-14 8:33
mvePete O'Hanlon9-Jul-14 8:33 
QuestionNeed some idea for resizing my control Pin
Super Lloyd8-Jul-14 4:22
Super Lloyd8-Jul-14 4:22 
QuestionShow items in multiple columns Pin
pjank423-Jul-14 22:06
pjank423-Jul-14 22:06 
AnswerRe: Show items in multiple columns Pin
Pete O'Hanlon3-Jul-14 23:03
mvePete O'Hanlon3-Jul-14 23:03 
GeneralRe: Show items in multiple columns Pin
pjank424-Jul-14 5:26
pjank424-Jul-14 5:26 
QuestionMultipass MeasureOverride() not calculating updated items size (added code sample) Pin
Super Lloyd2-Jul-14 3:50
Super Lloyd2-Jul-14 3:50 
QuestionDraw a rectangular box Pin
Subin Mavunkal1-Jul-14 23:24
Subin Mavunkal1-Jul-14 23:24 
AnswerRe: Draw a rectangular box Pin
Matt T Heffron2-Jul-14 13:53
professionalMatt T Heffron2-Jul-14 13:53 
QuestionXAML Pin
Member 97193591-Jul-14 22:21
Member 97193591-Jul-14 22:21 
AnswerRe: XAML Pin
Pete O'Hanlon1-Jul-14 22:55
mvePete O'Hanlon1-Jul-14 22:55 
QuestionWPF Expander Problem Pin
Kevin Marois1-Jul-14 13:49
professionalKevin Marois1-Jul-14 13:49 
AnswerRe: WPF Expander Problem Pin
Pete O'Hanlon1-Jul-14 19:11
mvePete O'Hanlon1-Jul-14 19:11 
QuestionWPF - PRism Framework Pin
Muhammed Nigil29-Jun-14 23:36
professionalMuhammed Nigil29-Jun-14 23:36 

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.