Click here to Skip to main content
15,867,835 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz4-Sep-22 8:57
mveGerry Schmitz4-Sep-22 8:57 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Richard Deeming5-Sep-22 21:11
mveRichard Deeming5-Sep-22 21:11 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz6-Sep-22 5:34
mveGerry Schmitz6-Sep-22 5:34 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Marc Jeeves6-Sep-22 10:05
Marc Jeeves6-Sep-22 10:05 
GeneralRe: Using Dependency Property's to Affect Non WPF Property's Pin
Gerry Schmitz6-Sep-22 13:19
mveGerry Schmitz6-Sep-22 13:19 
QuestionCan Not Bin to Dependency Property in Custom Control Pin
Marc Jeeves1-Sep-22 6:26
Marc Jeeves1-Sep-22 6:26 
AnswerRe: Can Not Bin to Dependency Property in Custom Control Pin
Richard Deeming1-Sep-22 6:35
mveRichard Deeming1-Sep-22 6:35 
GeneralRe: Can Not Bin to Dependency Property in Custom Control Pin
Marc Jeeves1-Sep-22 6:47
Marc Jeeves1-Sep-22 6:47 
QuestionWhat is the most common MVVM framework used today? Pin
Code4Ever21-Jul-22 7:26
Code4Ever21-Jul-22 7:26 
AnswerRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon21-Jul-22 21:21
subeditorPete O'Hanlon21-Jul-22 21:21 
AnswerRe: What is the most common MVVM framework used today? Pin
Richard Deeming21-Jul-22 21:22
mveRichard Deeming21-Jul-22 21:22 
AnswerRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz22-Jul-22 5:10
mveGerry Schmitz22-Jul-22 5:10 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon24-Jul-22 11:32
subeditorPete O'Hanlon24-Jul-22 11:32 
GeneralRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz25-Jul-22 20:43
mveGerry Schmitz25-Jul-22 20:43 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon25-Jul-22 21:30
subeditorPete O'Hanlon25-Jul-22 21:30 
QuestionIs it possible to do event handling in the ViewModel? Pin
Code4Ever16-Jul-22 6:39
Code4Ever16-Jul-22 6:39 
AnswerRe: Is it possible to do event handling in the ViewModel? Pin
Gerry Schmitz17-Jul-22 6:06
mveGerry Schmitz17-Jul-22 6:06 
QuestionDICOM TAGS Pin
harol espinosa26-Jun-22 5:20
harol espinosa26-Jun-22 5:20 
AnswerRe: DICOM TAGS Pin
Dave Kreskowiak26-Jun-22 6:13
mveDave Kreskowiak26-Jun-22 6:13 
QuestionDevelopment Pin
User 156237373-Jun-22 10:46
User 156237373-Jun-22 10:46 
AnswerRe: Development Pin
Gerry Schmitz4-Jun-22 10:35
mveGerry Schmitz4-Jun-22 10:35 
GeneralRe: Development Pin
User 156237376-Jun-22 4:22
User 156237376-Jun-22 4:22 
QuestionTreeView in ControlTemplate - Handling Item Expanded Pin
Kevin Marois27-Apr-22 9:46
professionalKevin Marois27-Apr-22 9:46 
QuestionWPF DataGridCell Binding Problem Pin
Kevin Marois7-Apr-22 14:39
professionalKevin Marois7-Apr-22 14:39 
I have a DataGrid bound to a list of models. On the ViewModel is a property called AreFieldsEnabled. When the user clicks Edit the it sets AreFieldsEnabled to true and the datagrid becomes enabled/

I have this style
<Style x:Key="dataGridCurrencyCellStyle" 
        BasedOn="{StaticResource dataGridCellStyle}"
        TargetType="{x:Type DataGridCell}">

    <Setter Property="Width" Value="75"/>
    <Setter Property="TextBlock.TextAlignment" Value="Left"/>
    <Setter Property="TextBlock.Text" Value="{Binding StringFormat=C}"/>
    <Setter Property="IsEnabled" Value="{Binding DataContext.AreFieldsEnabled, ElementName=budgetControl}"/>

</Style>

What I need do now is a change it to a MultiTrigger. On the model is a bool property called IsCellEnabled which I set programmatically when loading the data.
<Style x:Key="dataGridCurrencyCellStyle" 
        BasedOn="{StaticResource dataGridCellStyle}"
        TargetType="{x:Type DataGridCell}">

    <Setter Property="Width" Value="75"/>
    <Setter Property="TextBlock.TextAlignment" Value="Left"/>
    <Setter Property="TextBlock.Text" Value="{Binding StringFormat=C}"/>
    <Setter Property="IsEnabled" Value="False"/>

    <Style.Triggers>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="AreFieldsEnabled" Value="True" />
                <Condition Property="IsCellEnabled " Value="True" />
            </MultiTrigger.Conditions>
            <MultiTrigger.Setters>
                <Setter Property="IsEditing" Value="True" />
            </MultiTrigger.Setters>
        </MultiTrigger>
    </Style.Triggers>

</Style>

Now, both conditions are wrong and won't compile.

So, the AreFieldsEnabled property is on the ViewModel. The IsCellEnabled property is on the Model bound to the grid.

What's the right way to do this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 12-Apr-22 13:25pm.

AnswerRe: WPF DataGridCell Binding Prolem Pin
Richard Deeming7-Apr-22 21:36
mveRichard Deeming7-Apr-22 21: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.