How to store open state of particular ChildWindow in a property?











up vote
0
down vote

favorite












I use ChildWindows in my project and I need to store open state of particular ChildWindow in a property, then use that property as a condition for mentioned ChildWindow calling.



First I made this snippet of code. It has its drawbacks. So I want to use another way.



private void button1_Click(object sender, RoutedEventArgs e)
{
if (ChildWindow_02_in_XAML.IsOpen == false)

{
// await this.ShowChildWindowAsync(new ChildWindow_02() { IsModal = false, AllowMove = true, }, RootGrid);
Parameter_02_in_XAML.IsOpen = true;

}

else if (Parameter_02_in_XAML.IsOpen == true)

{

Parameter_02_in_XAML.Close();

}

else

{

return;

}

}


Now I have ChildWindow as a class, and I made following stuff:



 IsOpen="{Binding IschildWindow_02_Opened}"


And I'm going to use that method that is commented at the moment.



So I have a question how to process with this variable further.










share|improve this question
























  • Are you using MVVM? More info is needed. What have you tried?
    – ΩmegaMan
    Nov 7 at 16:22










  • No, I don't use MVVM.
    – DeputyOfCopyPaster
    Nov 7 at 16:45

















up vote
0
down vote

favorite












I use ChildWindows in my project and I need to store open state of particular ChildWindow in a property, then use that property as a condition for mentioned ChildWindow calling.



First I made this snippet of code. It has its drawbacks. So I want to use another way.



private void button1_Click(object sender, RoutedEventArgs e)
{
if (ChildWindow_02_in_XAML.IsOpen == false)

{
// await this.ShowChildWindowAsync(new ChildWindow_02() { IsModal = false, AllowMove = true, }, RootGrid);
Parameter_02_in_XAML.IsOpen = true;

}

else if (Parameter_02_in_XAML.IsOpen == true)

{

Parameter_02_in_XAML.Close();

}

else

{

return;

}

}


Now I have ChildWindow as a class, and I made following stuff:



 IsOpen="{Binding IschildWindow_02_Opened}"


And I'm going to use that method that is commented at the moment.



So I have a question how to process with this variable further.










share|improve this question
























  • Are you using MVVM? More info is needed. What have you tried?
    – ΩmegaMan
    Nov 7 at 16:22










  • No, I don't use MVVM.
    – DeputyOfCopyPaster
    Nov 7 at 16:45















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I use ChildWindows in my project and I need to store open state of particular ChildWindow in a property, then use that property as a condition for mentioned ChildWindow calling.



First I made this snippet of code. It has its drawbacks. So I want to use another way.



private void button1_Click(object sender, RoutedEventArgs e)
{
if (ChildWindow_02_in_XAML.IsOpen == false)

{
// await this.ShowChildWindowAsync(new ChildWindow_02() { IsModal = false, AllowMove = true, }, RootGrid);
Parameter_02_in_XAML.IsOpen = true;

}

else if (Parameter_02_in_XAML.IsOpen == true)

{

Parameter_02_in_XAML.Close();

}

else

{

return;

}

}


Now I have ChildWindow as a class, and I made following stuff:



 IsOpen="{Binding IschildWindow_02_Opened}"


And I'm going to use that method that is commented at the moment.



So I have a question how to process with this variable further.










share|improve this question















I use ChildWindows in my project and I need to store open state of particular ChildWindow in a property, then use that property as a condition for mentioned ChildWindow calling.



First I made this snippet of code. It has its drawbacks. So I want to use another way.



private void button1_Click(object sender, RoutedEventArgs e)
{
if (ChildWindow_02_in_XAML.IsOpen == false)

{
// await this.ShowChildWindowAsync(new ChildWindow_02() { IsModal = false, AllowMove = true, }, RootGrid);
Parameter_02_in_XAML.IsOpen = true;

}

else if (Parameter_02_in_XAML.IsOpen == true)

{

Parameter_02_in_XAML.Close();

}

else

{

return;

}

}


Now I have ChildWindow as a class, and I made following stuff:



 IsOpen="{Binding IschildWindow_02_Opened}"


And I'm going to use that method that is commented at the moment.



So I have a question how to process with this variable further.







c# wpf xaml visual-studio-2015 childwindow






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 16:56

























asked Nov 7 at 15:42









DeputyOfCopyPaster

45




45












  • Are you using MVVM? More info is needed. What have you tried?
    – ΩmegaMan
    Nov 7 at 16:22










  • No, I don't use MVVM.
    – DeputyOfCopyPaster
    Nov 7 at 16:45




















  • Are you using MVVM? More info is needed. What have you tried?
    – ΩmegaMan
    Nov 7 at 16:22










  • No, I don't use MVVM.
    – DeputyOfCopyPaster
    Nov 7 at 16:45


















Are you using MVVM? More info is needed. What have you tried?
– ΩmegaMan
Nov 7 at 16:22




Are you using MVVM? More info is needed. What have you tried?
– ΩmegaMan
Nov 7 at 16:22












No, I don't use MVVM.
– DeputyOfCopyPaster
Nov 7 at 16:45






No, I don't use MVVM.
– DeputyOfCopyPaster
Nov 7 at 16:45



















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',
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%2f53192827%2fhow-to-store-open-state-of-particular-childwindow-in-a-property%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53192827%2fhow-to-store-open-state-of-particular-childwindow-in-a-property%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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini