Click here to Skip to main content
15,885,216 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Overriding the default keys used to navigate in RadioButtons [WPF] [VB] Pin
SledgeHammer0110-May-11 11:55
SledgeHammer0110-May-11 11:55 
GeneralRe: Overriding the default keys used to navigate in RadioButtons [WPF] [VB] Pin
Jayme6510-May-11 12:58
Jayme6510-May-11 12:58 
AnswerRe: Overriding the default keys used to navigate in RadioButtons [WPF] [VB] Pin
Mark Salsbery10-May-11 12:04
Mark Salsbery10-May-11 12:04 
QuestionProblem in VisualTreeHelper.GetParent. Please guide me Pin
Hema Bairavan10-May-11 6:44
Hema Bairavan10-May-11 6:44 
AnswerRe: Problem in VisualTreeHelper.GetParent. Please guide me [modified] Pin
Mark Salsbery10-May-11 8:46
Mark Salsbery10-May-11 8:46 
GeneralRe: Problem in VisualTreeHelper.GetParent. Please guide me Pin
Hema Bairavan10-May-11 22:57
Hema Bairavan10-May-11 22:57 
QuestionRe: Problem in VisualTreeHelper.GetParent. Please guide me Pin
Mark Salsbery11-May-11 4:49
Mark Salsbery11-May-11 4:49 
QuestionWPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Nicolai Schrade10-May-11 5:01
Nicolai Schrade10-May-11 5:01 
Hi,

I'm trying desperately to get the following working, with no success Frown | :( :
So I hope someone here can help me.

I have a application following the MVVM pattern.
A WPF datagrid should have all it's cells backgrounds set either to Yellow or White, depending on a property on the ViewModel.
If the property returns "Locked", all cells should be Yellow.
If the property returns "Editable", all cells should be White.

Here's my XAML:
                <DataGrid x:Name="grdAnsprechpartner" Style="{Binding Path=StyleDataGrid}" 
                              AutoGenerateColumns="False" 
                              Height="auto"  Width="756" 
                              HorizontalAlignment="Left" VerticalAlignment="Top" 
                          ItemsSource="{Binding Path=AktuellerDatensatz.Personen}" >
                    <DataGrid.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="Background" Value="{Binding Path=CellBackground}"/>
                        </Style>
                    </DataGrid.CellStyle>
...


The Property "CellBackground" looks like this:
Public Overridable Property CellBackground() As SolidColorBrush
        Get
            Return p_CellBackground
        End Get
        Set(ByVal value As SolidColorBrush)
            If value.Equals(p_CellBackground) Then Return
            p_CellBackground = value
            OnPropertyChanged("CellBackground")
        End Set
    End Property


I'm setting myViewModel.CellBackground to - for example - Brushes.Yellow.
Nothing happens.

What am I doing wrong?

If I set the CellStyle's Background-property to a StaticResource, it works.

Kind regards,
Nico
AnswerRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Ian Shlasko10-May-11 5:38
Ian Shlasko10-May-11 5:38 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Nicolai Schrade10-May-11 6:00
Nicolai Schrade10-May-11 6:00 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Ian Shlasko10-May-11 6:09
Ian Shlasko10-May-11 6:09 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Nicolai Schrade10-May-11 6:35
Nicolai Schrade10-May-11 6:35 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Ian Shlasko10-May-11 6:52
Ian Shlasko10-May-11 6:52 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Nicolai Schrade10-May-11 22:57
Nicolai Schrade10-May-11 22:57 
AnswerRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Pete O'Hanlon10-May-11 6:35
mvePete O'Hanlon10-May-11 6:35 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Nicolai Schrade10-May-11 22:58
Nicolai Schrade10-May-11 22:58 
GeneralRe: WPF Datagrid and MVVM - Binding CellStyle to a ViewModel Property Pin
Pete O'Hanlon10-May-11 23:46
mvePete O'Hanlon10-May-11 23:46 
QuestionStretch StatusBarItem Pin
Jean-Louis Leroy10-May-11 4:06
Jean-Louis Leroy10-May-11 4:06 
AnswerRe: Stretch StatusBarItem Pin
Ian Shlasko10-May-11 4:35
Ian Shlasko10-May-11 4:35 
GeneralRe: Stretch StatusBarItem Pin
Jean-Louis Leroy10-May-11 5:08
Jean-Louis Leroy10-May-11 5:08 
QuestionDatabinding CheckBox in a ListBox Pin
kurmanc9-May-11 6:30
kurmanc9-May-11 6:30 
AnswerRe: Databinding CheckBox in a ListBox Pin
Ian Shlasko9-May-11 6:36
Ian Shlasko9-May-11 6:36 
GeneralRe: Databinding CheckBox in a ListBox [modified] Pin
kurmanc9-May-11 8:38
kurmanc9-May-11 8:38 
GeneralRe: Databinding CheckBox in a ListBox Pin
Ian Shlasko9-May-11 8:46
Ian Shlasko9-May-11 8:46 
GeneralRe: Databinding CheckBox in a ListBox Pin
kurmanc9-May-11 21:23
kurmanc9-May-11 21:23 

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.