DataTrigger is not setting the opacity












0















I have a datagrid with data trigger.





            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Opacity" Value="1"/>
<Style.Triggers>
<DataTrigger x:Uid="DataTrigger_1" x:Name="RowMenuDataTrigger" Binding="{Binding IsModified, diag:PresentationTraceSources.TraceLevel=High}" Value="True">
<Setter x:Uid="Setter_1" Property="Opacity" Value="0.5" />
<Setter x:Uid="Setter_2" Property="ToolTip">
<Setter.Value>
<MultiBinding x:Uid="MultiBinding_1" Converter="{StaticResource ModifiedTypeMessage}">
<Binding x:Uid="Binding_1" Path="Class"></Binding>
<Binding x:Uid="Binding_2" Path="OriginalClassName" ></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>

</control:DataGrid.RowStyle>


and IMultiValueConverter looks like:



public class EnTypeModifiedMessageConverter : IMultiValueConverter
{
public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2)
{
string current = values[0].ToString();
string original = values[1].ToString();

if (current != original)
{
return string.Format(LanguageHelper.LocalizedString("RawTypeModified"), original.ToUpper());
}
}
return string.Empty;
}

public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}


when the data changes I get the control hitting this converter. but the UI still not updated. ie opacity and tooltip remains same.










share|improve this question

























  • can i have a complete code?

    – CodeConstruct
    Nov 20 '18 at 5:07






  • 1





    I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

    – Klaus Gütter
    Nov 20 '18 at 6:15













  • I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

    – kurakura88
    Nov 20 '18 at 9:20











  • Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

    – Coops
    Nov 20 '18 at 11:00











  • I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

    – Developer123
    Nov 26 '18 at 10:04


















0















I have a datagrid with data trigger.





            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Opacity" Value="1"/>
<Style.Triggers>
<DataTrigger x:Uid="DataTrigger_1" x:Name="RowMenuDataTrigger" Binding="{Binding IsModified, diag:PresentationTraceSources.TraceLevel=High}" Value="True">
<Setter x:Uid="Setter_1" Property="Opacity" Value="0.5" />
<Setter x:Uid="Setter_2" Property="ToolTip">
<Setter.Value>
<MultiBinding x:Uid="MultiBinding_1" Converter="{StaticResource ModifiedTypeMessage}">
<Binding x:Uid="Binding_1" Path="Class"></Binding>
<Binding x:Uid="Binding_2" Path="OriginalClassName" ></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>

</control:DataGrid.RowStyle>


and IMultiValueConverter looks like:



public class EnTypeModifiedMessageConverter : IMultiValueConverter
{
public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2)
{
string current = values[0].ToString();
string original = values[1].ToString();

if (current != original)
{
return string.Format(LanguageHelper.LocalizedString("RawTypeModified"), original.ToUpper());
}
}
return string.Empty;
}

public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}


when the data changes I get the control hitting this converter. but the UI still not updated. ie opacity and tooltip remains same.










share|improve this question

























  • can i have a complete code?

    – CodeConstruct
    Nov 20 '18 at 5:07






  • 1





    I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

    – Klaus Gütter
    Nov 20 '18 at 6:15













  • I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

    – kurakura88
    Nov 20 '18 at 9:20











  • Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

    – Coops
    Nov 20 '18 at 11:00











  • I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

    – Developer123
    Nov 26 '18 at 10:04
















0












0








0








I have a datagrid with data trigger.





            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Opacity" Value="1"/>
<Style.Triggers>
<DataTrigger x:Uid="DataTrigger_1" x:Name="RowMenuDataTrigger" Binding="{Binding IsModified, diag:PresentationTraceSources.TraceLevel=High}" Value="True">
<Setter x:Uid="Setter_1" Property="Opacity" Value="0.5" />
<Setter x:Uid="Setter_2" Property="ToolTip">
<Setter.Value>
<MultiBinding x:Uid="MultiBinding_1" Converter="{StaticResource ModifiedTypeMessage}">
<Binding x:Uid="Binding_1" Path="Class"></Binding>
<Binding x:Uid="Binding_2" Path="OriginalClassName" ></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>

</control:DataGrid.RowStyle>


and IMultiValueConverter looks like:



public class EnTypeModifiedMessageConverter : IMultiValueConverter
{
public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2)
{
string current = values[0].ToString();
string original = values[1].ToString();

if (current != original)
{
return string.Format(LanguageHelper.LocalizedString("RawTypeModified"), original.ToUpper());
}
}
return string.Empty;
}

public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}


when the data changes I get the control hitting this converter. but the UI still not updated. ie opacity and tooltip remains same.










share|improve this question
















I have a datagrid with data trigger.





            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="Opacity" Value="1"/>
<Style.Triggers>
<DataTrigger x:Uid="DataTrigger_1" x:Name="RowMenuDataTrigger" Binding="{Binding IsModified, diag:PresentationTraceSources.TraceLevel=High}" Value="True">
<Setter x:Uid="Setter_1" Property="Opacity" Value="0.5" />
<Setter x:Uid="Setter_2" Property="ToolTip">
<Setter.Value>
<MultiBinding x:Uid="MultiBinding_1" Converter="{StaticResource ModifiedTypeMessage}">
<Binding x:Uid="Binding_1" Path="Class"></Binding>
<Binding x:Uid="Binding_2" Path="OriginalClassName" ></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>

</control:DataGrid.RowStyle>


and IMultiValueConverter looks like:



public class EnTypeModifiedMessageConverter : IMultiValueConverter
{
public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2)
{
string current = values[0].ToString();
string original = values[1].ToString();

if (current != original)
{
return string.Format(LanguageHelper.LocalizedString("RawTypeModified"), original.ToUpper());
}
}
return string.Empty;
}

public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}


when the data changes I get the control hitting this converter. but the UI still not updated. ie opacity and tooltip remains same.







c# wpf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 6:41









Poul Bak

5,44331232




5,44331232










asked Nov 20 '18 at 4:44









Developer123Developer123

11




11













  • can i have a complete code?

    – CodeConstruct
    Nov 20 '18 at 5:07






  • 1





    I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

    – Klaus Gütter
    Nov 20 '18 at 6:15













  • I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

    – kurakura88
    Nov 20 '18 at 9:20











  • Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

    – Coops
    Nov 20 '18 at 11:00











  • I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

    – Developer123
    Nov 26 '18 at 10:04





















  • can i have a complete code?

    – CodeConstruct
    Nov 20 '18 at 5:07






  • 1





    I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

    – Klaus Gütter
    Nov 20 '18 at 6:15













  • I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

    – kurakura88
    Nov 20 '18 at 9:20











  • Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

    – Coops
    Nov 20 '18 at 11:00











  • I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

    – Developer123
    Nov 26 '18 at 10:04



















can i have a complete code?

– CodeConstruct
Nov 20 '18 at 5:07





can i have a complete code?

– CodeConstruct
Nov 20 '18 at 5:07




1




1





I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

– Klaus Gütter
Nov 20 '18 at 6:15







I tried to reproduce your problem but failed - the DataTrigger worked for me. So indeed, please provide us a MCVE

– Klaus Gütter
Nov 20 '18 at 6:15















I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

– kurakura88
Nov 20 '18 at 9:20





I do not think EnTypeModifiedMessageConverter is relevant here. Make sure that you indeed change the IsModified value to True somewhere (in your ViewModel?).

– kurakura88
Nov 20 '18 at 9:20













Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

– Coops
Nov 20 '18 at 11:00





Is it that the converter is not working correctly or that both of the Setters are not doing as expected?

– Coops
Nov 20 '18 at 11:00













I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

– Developer123
Nov 26 '18 at 10:04







I found that IsModified was getting True from the VM. Therefore UI was getting RESET. Works fine after modifying the VM.

– Developer123
Nov 26 '18 at 10:04














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386373%2fdatatrigger-is-not-setting-the-opacity%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386373%2fdatatrigger-is-not-setting-the-opacity%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

The term 'EXEC' is not recognized as the name of a cmdlet Powershell

NPM command prompt closes immediately [closed]

Error binding properties and functions in emscripten