Click here to Skip to main content
15,911,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to upgrade existing application ...? Pin
led mike16-Jan-08 5:42
led mike16-Jan-08 5:42 
QuestionAssigning WPF Styles at runtime [modified] Pin
AlexZ7114-Jan-08 20:57
AlexZ7114-Jan-08 20:57 
Hi,

I want to assign Styles to certain WPF UserControls at runtime. The first assignment always works, but assigning other Styles to the control never results in calling the PropertyChangeCallbacks. On the other hand OnStyleChange is called...?

The DP-definition of the UserControl looks like following:

public static readonly DependencyProperty FooterGradientBottomProperty = 
   DependencyProperty.Register ("FooterGradientBottom", typeof (Color), 
   typeof (subItem), new FrameworkPropertyMetadata (Color.FromArgb (255, 255, 255, 255),
   FrameworkPropertyMetadataOptions.AffectsRender, 
   new PropertyChangedCallback (FooterGradientBottom_Changed)));

public Color FooterGradientBottom
{
    get
    {
        return (Color) GetValue (FooterGradientBottomProperty);
    }

    set
    {
        SetValue (FooterGradientBottomProperty, value);
        this.footerGradientBottom.Color = value;
    }
}

private static void FooterGradientBottom_Changed (object sender,
   DependencyPropertyChangedEventArgs args)
{
    ((subItem) sender).FooterGradientBottom = (Color) args.NewValue;
}


The Style-item, which shall be changed by the DPs was defined in XAML like this:

<code>
...
<GradientStop x:Name="footerGradientBottom" Offset="1"/>
...
</code>

Finally I assign Styles (from the static resource) to the UserControl in following way:

<code>
this.Style = (Style) this.FindResource ("HighlightedStyle");
</code>

As mentioned, the first Style is applied properly, all following assignments are without effect.

Has somebody an idea why?

Many thanks in advance,
Alex

modified on Tuesday, January 15, 2008 3:35:20 AM

QuestionNot Able to Send Mail Through C# Code Pin
Neeraj Kr14-Jan-08 20:30
Neeraj Kr14-Jan-08 20:30 
GeneralRe: Not Able to Send Mail Through C# Code Pin
Abhijit Jana14-Jan-08 20:31
professionalAbhijit Jana14-Jan-08 20:31 
GeneralRe: Not Able to Send Mail Through C# Code Pin
Neeraj Kr14-Jan-08 22:21
Neeraj Kr14-Jan-08 22:21 
GeneralRe: Not Able to Send Mail Through C# Code Pin
justintimberlake14-Jan-08 21:05
justintimberlake14-Jan-08 21:05 
QuestionSetting the color of a component (R:G:B) Pin
Programm3r14-Jan-08 20:24
Programm3r14-Jan-08 20:24 
GeneralRe: Setting the color of a component (R:G:B) Pin
Abhijit Jana14-Jan-08 20:30
professionalAbhijit Jana14-Jan-08 20:30 
GeneralRe: Setting the color of a component (R:G:B) Pin
Programm3r14-Jan-08 20:44
Programm3r14-Jan-08 20:44 
QuestionCompiling .Net 1.1 Pin
Muammar©14-Jan-08 20:17
Muammar©14-Jan-08 20:17 
GeneralRe: Compiling .Net 1.1 Pin
Ajay.k_Singh14-Jan-08 21:53
Ajay.k_Singh14-Jan-08 21:53 
GeneralRe: Compiling .Net 1.1 Pin
Muammar©14-Jan-08 23:51
Muammar©14-Jan-08 23:51 
GeneralRe: Compiling .Net 1.1 Pin
PIEBALDconsult15-Jan-08 15:42
mvePIEBALDconsult15-Jan-08 15:42 
GeneralRe: Compiling .Net 1.1 Pin
Muammar©15-Jan-08 18:40
Muammar©15-Jan-08 18:40 
GeneralRe: Compiling .Net 1.1 Pin
mav.northwind15-Jan-08 19:14
mav.northwind15-Jan-08 19:14 
GeneralRe: Compiling .Net 1.1 Pin
Muammar©15-Jan-08 21:42
Muammar©15-Jan-08 21:42 
GeneralRe: Compiling .Net 1.1 Pin
mav.northwind16-Jan-08 8:02
mav.northwind16-Jan-08 8:02 
GeneralRe: Compiling .Net 1.1 Pin
Muammar©18-Jan-08 19:27
Muammar©18-Jan-08 19:27 
QuestionHow can i write application in Doc/view architecture in C# ? Pin
Yanshof14-Jan-08 19:14
Yanshof14-Jan-08 19:14 
AnswerRe: How can i write application in Doc/view architecture in C# ? Pin
Pete O'Hanlon15-Jan-08 3:16
mvePete O'Hanlon15-Jan-08 3:16 
QuestionNative XP/Vista Menu Pin
KienNT7814-Jan-08 17:53
KienNT7814-Jan-08 17:53 
GeneralRe: Native XP/Vista Menu Pin
Paul Conrad17-Jan-08 13:31
professionalPaul Conrad17-Jan-08 13:31 
GeneralRe: Native XP/Vista Menu Pin
Laserson24-Aug-09 19:38
Laserson24-Aug-09 19:38 
Generaldebugging Pin
justintimberlake14-Jan-08 17:22
justintimberlake14-Jan-08 17:22 
GeneralRe: debugging Pin
Skippums14-Jan-08 17:32
Skippums14-Jan-08 17:32 

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.