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

WPF

 
GeneralRe: DataGrid Event Not Firing Pin
Kevin Marois2-Dec-23 7:41
professionalKevin Marois2-Dec-23 7:41 
QuestionDataGrid Exception Pin
Kevin Marois28-Nov-23 11:36
professionalKevin Marois28-Nov-23 11:36 
AnswerRe: DataGrid Exception Pin
Richard Deeming28-Nov-23 22:30
mveRichard Deeming28-Nov-23 22:30 
GeneralRe: DataGrid Exception Pin
Kevin Marois29-Nov-23 7:12
professionalKevin Marois29-Nov-23 7:12 
GeneralRe: DataGrid Exception Pin
Kevin Marois29-Nov-23 8:13
professionalKevin Marois29-Nov-23 8:13 
GeneralRe: DataGrid Exception Pin
Richard Deeming29-Nov-23 22:22
mveRichard Deeming29-Nov-23 22:22 
GeneralRe: DataGrid Exception Pin
Kevin Marois30-Nov-23 6:46
professionalKevin Marois30-Nov-23 6:46 
QuestionCustom Control Style Question Revisited Pin
Kevin Marois30-Oct-23 9:14
professionalKevin Marois30-Oct-23 9:14 
I've asked about this already, but I'm not really getting it. I'm asking this again with more detail in the hopes that it'll make more sense.

Lets say I develop a custom control that have a TextBlock over a TextBox[^]. I have defind colors for Normal and Mouse Over

Here's the XAML for my control. It's pretty simple:
<pre><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:MyTextBoxEx">

<pre>
<SolidColorBrush x:Key="CaptionNormalColor" Color="Green"/>
<SolidColorBrush x:Key="CaptionMouseOverColor" Color="Purple"/>

<SolidColorBrush x:Key="TextNormalColor" Color="Red"/>
<SolidColorBrush x:Key="TextMouseOverColor" Color="Blue"/>

<Style TargetType="{x:Type local:TextBoxEx}">

    <Setter Property="Padding" Value="1"/>

    <Setter Property="Template">

        <Setter.Value>

            <ControlTemplate TargetType="{x:Type local:TextBoxEx}">

                <StackPanel Orientation="Vertical">

                    <Border Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}"
                            Margin="{Binding Margin, RelativeSource={RelativeSource TemplatedParent}}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <StackPanel Orientation="Vertical">

                            <TextBlock x:Name="caption"
                                       Foreground="{StaticResource CaptionNormalColor}"
                                       Text="{TemplateBinding Caption}"/>

                            <TextBox x:Name="text"
                                     Foreground="{StaticResource TextNormalColor}"
                                     Text="{TemplateBinding Text}"/>

                        </StackPanel>

                    </Border>

                </StackPanel>

                <ControlTemplate.Triggers>

                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter TargetName="caption" Property="TextElement.Foreground" Value="{StaticResource CaptionMouseOverColor}"/>
                        <Setter TargetName="caption" Property="TextElement.FontWeight" Value="Bold"/>

                        <Setter TargetName="text" Property="TextElement.Foreground" Value="{StaticResource TextMouseOverColor}"/>
                        <Setter TargetName="text" Property="TextElement.FontStyle" Value="Italic"/>
                    </Trigger>

                </ControlTemplate.Triggers>

            </ControlTemplate>

        </Setter.Value>

    </Setter>

</Style>



Here's the question. I have assigned colors for normal, and for the Mouse Over triggers. Assume this control was in a compiled assembly, and I gave it to you, how would you go about overwriting the theme colors, or theming it the way you wanted?

When you buy a third party control, and want apply your theme to it, how do the controls inside get their colors set? In my case, the triggers are set to a specifically named brush. Just knowing the brush names wouldn't help you overwrite the theme colors, would it?
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.

AnswerRe: Custom Control Style Question Revisited Pin
Gerry Schmitz30-Oct-23 12:20
mveGerry Schmitz30-Oct-23 12:20 
GeneralRe: Custom Control Style Question Revisited Pin
Kevin Marois31-Oct-23 8:01
professionalKevin Marois31-Oct-23 8:01 
QuestionUI Validation Problem Pin
Kevin Marois10-Oct-23 13:10
professionalKevin Marois10-Oct-23 13:10 
AnswerRe: UI Validation Problem Pin
Richard Deeming10-Oct-23 22:13
mveRichard Deeming10-Oct-23 22:13 
GeneralRe: UI Validation Problem Pin
Kevin Marois12-Oct-23 7:25
professionalKevin Marois12-Oct-23 7:25 
GeneralRe: UI Validation Problem Pin
Richard Deeming12-Oct-23 21:34
mveRichard Deeming12-Oct-23 21:34 
AnswerRe: UI Validation Problem Pin
Gerry Schmitz12-Oct-23 8:52
mveGerry Schmitz12-Oct-23 8:52 
GeneralRe: UI Validation Problem Pin
Kevin Marois12-Oct-23 14:54
professionalKevin Marois12-Oct-23 14:54 
GeneralRe: UI Validation Problem Pin
Gerry Schmitz12-Oct-23 19:12
mveGerry Schmitz12-Oct-23 19:12 
GeneralRe: UI Validation Problem Pin
Kevin Marois16-Oct-23 12:50
professionalKevin Marois16-Oct-23 12:50 
QuestionUI Validation Questions Pin
Kevin Marois29-Sep-23 15:54
professionalKevin Marois29-Sep-23 15:54 
AnswerRe: UI Validation Questions Pin
Richard Deeming1-Oct-23 21:43
mveRichard Deeming1-Oct-23 21:43 
QuestionCustom Control Style Question Pin
Kevin Marois14-Sep-23 12:35
professionalKevin Marois14-Sep-23 12:35 
AnswerRe: Custom Control Style Question Pin
Gerry Schmitz14-Sep-23 12:57
mveGerry Schmitz14-Sep-23 12:57 
GeneralRe: Custom Control Style Question Pin
Kevin Marois15-Sep-23 5:33
professionalKevin Marois15-Sep-23 5:33 
GeneralRe: Custom Control Style Question Pin
Gerry Schmitz15-Sep-23 5:58
mveGerry Schmitz15-Sep-23 5:58 
GeneralRe: Custom Control Style Question Pin
Kevin Marois15-Sep-23 14:54
professionalKevin Marois15-Sep-23 14:54 

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.