none
How can I make GraphPaper for InkCnavas to be activated with a button ? RRS feed

Answers

  • @Javier,

    Yep. The GraphPaper is a usercontrol, it has the Visibility property. You can set this property from your Toggleswitch control's ToggleSwitch_Toggled event. For example, give your GraphPaper a x:name and set it like:

    private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
            {
                ToggleSwitch toggleSwitch = sender as ToggleSwitch;
                if (toggleSwitch != null)
                {
                    if (toggleSwitch.IsOn == true)
                    {
                        myGraphPaper.Visibility=Visibility.Visible;
                    }
                    else
                    {
                       myGraphPaper.Visibility=Visibility.Collapsed;
                    }
                }
            }

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by FEC-4RP Thursday, November 1, 2018 5:14 PM
    • Marked as answer by Javier Ra Monday, March 4, 2019 6:42 PM
    Friday, October 19, 2018 1:57 AM
    Moderator
  • Hello Javier Ra,

    If you'd like to hide "graphPaper" on start-up, just set Visibility="Collapsed" in XAML.

    <ctrl:GraphPaperUserControl xmlns:ctrl="using:GraphPaperControl.UserControls" x:Name="graphPaper" Visibility="Collapsed" />

    • Marked as answer by Javier Ra Thursday, November 1, 2018 4:01 PM
    Wednesday, October 31, 2018 6:46 AM
  • Hey Javier Ra,

    Barry's post (about ToggleSwitch.Toggled event handler) is much more important for solution in this case. So rather, mark it as answer. Thank you.

    • Marked as answer by Javier Ra Wednesday, November 21, 2018 7:35 AM
    Thursday, November 1, 2018 5:15 PM

All replies

  • Hello Javier Ra,

    Each usercontrol has a property called Visibility property. You can set your usercontrol's property at runtime from your button to make it show or hide.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 18, 2018 2:37 AM
    Moderator
  • I want to do is activate and desactivating in the Grappaper through the Toggleswitch
    • Edited by Javier Ra Thursday, October 18, 2018 8:28 AM mistake
    Thursday, October 18, 2018 8:27 AM
  • @Javier,

    Yep. The GraphPaper is a usercontrol, it has the Visibility property. You can set this property from your Toggleswitch control's ToggleSwitch_Toggled event. For example, give your GraphPaper a x:name and set it like:

    private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
            {
                ToggleSwitch toggleSwitch = sender as ToggleSwitch;
                if (toggleSwitch != null)
                {
                    if (toggleSwitch.IsOn == true)
                    {
                        myGraphPaper.Visibility=Visibility.Visible;
                    }
                    else
                    {
                       myGraphPaper.Visibility=Visibility.Collapsed;
                    }
                }
            }

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by FEC-4RP Thursday, November 1, 2018 5:14 PM
    • Marked as answer by Javier Ra Monday, March 4, 2019 6:42 PM
    Friday, October 19, 2018 1:57 AM
    Moderator
  • Hello:

    it works but i have doubt when i open the application i automatically leave GrapPaper is supposed to be the toggleswitch is that activates it

    Friday, October 19, 2018 8:51 AM
  • @Javier,

    What do you mean? Set it Collapsed by default and then your users will be able to find your toggleswitch to enable/disable the GraphPaper. If this is not what you mean please describe your request more clear.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, October 22, 2018 7:17 AM
    Moderator
  • When I open the App GraphPaper in InkCanvasbut ToggleSwitch is disabled. To remove it i Have to give it to actívate it and if i want to remove GrapHPaper ihave to desactivate toggeswitch.

    Tuesday, October 23, 2018 8:37 AM
  • @Javier Ra,

    Why don't directly set the toggleSwitch to on by default? 

    https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.toggleswitch.ison#Windows_UI_Xaml_Controls_ToggleSwitch_IsOn

    Set this property when you initialize your UI, then it will be on by default. To disable it your customer just need to click another button to pop out the toggleswitch then they will be able to close it. Does this make sense to you?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 24, 2018 5:52 AM
    Moderator
  • Because it happens that GraphPaper comes out by default when ToggleSwtich activates GraphPaper.
    Wednesday, October 24, 2018 6:57 PM
  • @Javier,

    Sorry I don't understand your request. Unless you can describe what you want out, I'm not able to share you a workaround. Can you help me to know what is your question right now?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 25, 2018 3:04 AM
    Moderator
  • Toggleswitch is supposed to Enable and Disable Graphpaper, the problem may be in this code
    void OnLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
    {
      // Added a member variable of type CoreWetStrokeUpdateSource called 'wetUpdateSource'
      this.wetUpdateSource = CoreWetStrokeUpdateSource.Create(this.inkCanvas.InkPresenter);
      this.wetUpdateSource.WetStrokeStarting += OnStrokeStarting;
      this.wetUpdateSource.WetStrokeContinuing += OnStrokeContinuing;
    }

    Thursday, October 25, 2018 12:14 PM
  • @Javier Ra,

    So maybe some more details about what the actually problem is? The code you provided is not related to toggleswitch in my mind.

    Best regards,

    Barry



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 30, 2018 9:27 AM
    Moderator
  • this is code : 

    GraphPaper

    Tuesday, October 30, 2018 10:03 AM
  • Hello Javier Ra,

    If you'd like to hide "graphPaper" on start-up, just set Visibility="Collapsed" in XAML.

    <ctrl:GraphPaperUserControl xmlns:ctrl="using:GraphPaperControl.UserControls" x:Name="graphPaper" Visibility="Collapsed" />

    • Marked as answer by Javier Ra Thursday, November 1, 2018 4:01 PM
    Wednesday, October 31, 2018 6:46 AM
  • Thank You . 

    It's already working properly.

    Thursday, November 1, 2018 4:02 PM
  • Hey Javier Ra,

    Barry's post (about ToggleSwitch.Toggled event handler) is much more important for solution in this case. So rather, mark it as answer. Thank you.

    • Marked as answer by Javier Ra Wednesday, November 21, 2018 7:35 AM
    Thursday, November 1, 2018 5:15 PM