**SILVERLIGHT**
The breakpoint feature is not working in silverlight 5.Please tell me what's the issue and how to resolve the Issue.
**XAML DESIGN**
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Width="200" Height="200" Grid.Column="0" BorderBrush="Red" BorderThickness="2" Background="Azure" MouseLeftButtonDown="Border_MouseLeftButtonDown"/>
<ListBox x:Name="lstClickReport" Grid.Column="1" Margin="10" Width="300" Height="200"/>-->
<TextBlock x:Name="txtBlock" HorizontalAlignment="Center" Text="{Binding Message}"/>
</Grid>
</UserControl>
Please do the needful.
Have a look in the Output window and see if the module has been built. Sometimes, you might have accidentally turned it off in the ConfigurationManager.
Furthermore, internet explorer caching has been also responsible for holding on to old copies of DLLs, especially if you are running with Assembly Library Caching.
As described in this article, XAML is a markup language, some of the typical strategies for debugging within Visual Studio are not available.
For example, there is no way to set a breakpoint within a XAML file. This topic describes how XAML works in the Silverlight architecture while in a debugging context, and provides some strategies for eliminating problems in Silverlight XAML during the design and development phase. That's why you can not setup the breakpoint in your XAML.
[EDIT 08/28/2012]
I did not know that XAML debugging is added into SL5 so after #jv42 suggested XAML debugging is working in SL5, I decided to give a quick try. What i found is that XAML allows breakpoint setting to Binding syntax only within any XAML element means the property must have a binding to it to for being enabled to debug.
BP will not hit:
<Grid x:Name="LayoutRoot" Background="Red">
<TextBlock Text="Hello World"/>
</Grid>
BP Will hit:
<Grid x:Name="LayoutRoot" Background="Red">
<TextBlock Text="{Binding ****}"/>
</Grid>
Once Binding is properly configured you can see the BP hit and BindingState is populated in Local.
In above case I think the BP did not hit because in {Binding Message} the Message part is not properly configured. It would be good to know the code behind the "Message" and how this property is set. Unless binding is set properly the BP will not hit the XAML.
Related
How does one translate the Microsoft ButtonBase.Click Event information for C++/WinRT into a prototype declaration and definition?
In Visual Studio Community 2017, version 15.9.5, I created a standard project, viz., Blank App (C++/WinRT), which has a button (myButton) as part of it. I want to learn how to add a second button. I have added the XAML code for a second button (myButton2), but thereafter I am stuck.
<Page
x:Class="X003.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:X003"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel x:Name="stackPan" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Background="LightBlue">
<Button x:Name="myButton" Click="ClickHandler">Click Me</Button>
<Button x:Name="myButton2" Click="ClickHandler2">Click Me2</Button>
</StackPanel>
</Page>
I could just copy the code from the first button that the Blank App (C++/WinRT) provided. But, if I did not have the first button as an example, I would not know how I would translate the Microsoft documentation, viz.,
// Register
event_token Click(RoutedEventHandler const& handler) const;
// Revoke with event_token
void Click(event_token const& cookie) const;
// Revoke with event_revoker
Click_revoker Click(auto_revoke_t, RoutedEventHandler const& handler) const;
into a Click handler. The first line of the Microsoft documentation, viz.,
event_token Click(RoutedEventHandler const& handler) const;
is, I take it, the format to be used in creating the handler. It does not look like the handler already in the project, viz.,
void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
I thought that it could be added to the .idl file. But, the .idl file does not have the first button in it.
The example code with Microsoft provides is for C#, even when "C++/WinRT" is selected at the top-right of the page.
The new version of C++/WinRT has a lot of documentation, almost too much. Coming from having used C#/WPF/XAML, I cannot see my way clearly to doing similar work with C++/WinRT.
Finally, the project Properties tab is of no help. In C# the events were listed and choosing one would result in a declaration and basic definition being created in the code. For C++/WinRT, when the cursor is on the control in the XAML page, the events section of the Properties page shows the name of the control, myButton or myButton2, and indicates "The document item has no code-behind file. Add a code-behind file and a class definition before adding event handlers." But, there is no code-behind file for the existing button, myButton.
How does one translate the Microsoft ButtonBase.Click Event information for C++/WinRT into a prototype declaration and definition?
Not sure what do you mean by prototype declaration and definition since given information itself is prototype.
In this page you can find more information about event handling in C++/Winrt. Link explains about handling and revoking events with delegates and gives example of Button click event handling for C++/WinRT. In short you need to have handler and register it through delegate.
// function that handles event
void MainPage::ClickHandler(IInspectable const& /* sender */, RoutedEventArgs const& /* args */)
{
Button().Content(box_value(L"Clicked"));
}
...
// register above function for event handler
Button().Click({ this, &MainPage::ClickHandler });
UPD: I tried to check regarding error The document item has no code-behind file. Add a code-behind file and a class definition before adding event handlers when user tries to access Properties and Event Handlers. I could easily reproduce this issue by creating Blank App (C++/Winrt) after installing cppwinrt extension.
I checked photo editor sample app from ms github to further down debug this problem. In this sample app I failed to load XAML design mode. First it requested me to update my Windows version to 1809, but I failed to update. So I decided to rollback to this commit id which does not require Windows 1809 update.
After this XAML design failed with Some assembly references are missing. Building to restore the NuGet cache might resolve this issue. error. Research lead me to this issue which is closed with following comment
This is currently unsupported. The XAML team is currently working on designer support, so you should see this light up in a future update to the Windows SDK.
After opening issue in MS docs github, I got following response from them and according page of MS docs was updated.
I've added the following info to the "Blank App (C++/WinRT)" subsection of this topic, since that's the project template that uses XAML as its UI.
"Visual Studio's XAML design surface support for C++/WinRT is close to parity with C#. One exception is the Events tab of the Properties window. With a C# project, you can use that tab to add event handlers; with a C++/WinRT project, that facility is not present. But see Handle events by using delegates in C++/WinRT for info on how to add event handlers to your code."
This change should be live soon. Please let me know if there's anything further I can add.
I have installed 7.5 and the progress was 7.0 -> 7.2 -> 7.5
However, when I click "Insert Link", "Media Link.. " and some specific link in content editor, Sitecore says the dialog path can not be found.
So, I knew that Sheer UI (old UI) replaced with SPEAK UI from 7.2. Many articles (https://briancaos.wordpress.com/2014/07/02/disable-sitecore-speak-dialogs/) says that I can comment out "overrideDialogs" node in "Sitecore.Speak.config" file to keep using old UI. But, the nodes are located at "Sitecore.Speak.Applications.config" file, not "Sitecore.Speak.config" file.
I tried to comment out the node in "Sitecore.Speak.Application.config" file, but it doesn't make the dialog UI pop up and it shows me the same error.
How can I change this back to use old dialog UI in 7.5?
Or, how can I enable SPEAK dialog UI in 7.5??
How about taking a brand new 7.5 install and copying the "sitecore" directory to your existing, upgraded instance?
Yes, that can be achieved by disabling Speak overrideXmlControls in the Sitecore.Speak.config indeed. Create a custom configuration with the following code.
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<overrideXmlControls>
<override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" with="/sitecore/client/applications/Dialogs/SelectMediaDialog">
<patch:delete />
</override>
</overrideXmlControls>
</sitecore>
Important! Keep in mind the order so that the configuration file needs to be bellow the Sitecore.Speak.config in the Include folder otherwise the configuration file won’t work because the original Sitecore.Speak.config overrides won`t be registered (a good name will be z_Sitecore.Speak.Overrides.config). Full article available here:
http://sitecorecorner.com/2014/08/13/switch-sitecore-7-2-speak-ui-media-browser-to-the-good-old-sheer-ui-media-browser/
I am currently tracing my errors in an MFC application to a .log file and to the event viewer, but I would also like to trace to the console. A console solution is posted here:
http://www.codeproject.com/Articles/612/Creating-a-console-for-your-MFC-app-s-debug-output
but I want to be able to turn it on and off easily (Perhaps with a TraceSwitch).
In addition to the obvious,
<add name="LPRConsoleListener" type=System.Diagnostics.ConsoleTraceListener" />
You must put
AllocConsole()
in your InitInstance() function before you initialize your MFC Window.
Which control in Win32 support wrap text like bellow and support mouse down event like Run in C# (as in picture below)? If there isn's have built in control, which libray I can use? Thank!
<TextBlock TextWrapping="Wrap" FontSize="20" Margin="10">
<Run>A text run.</Run>
<Run Background="Yellow" MouseDown="Run_MouseDown">
<!-- Support mouse down event -->
This is long Run that auto wrap to begin of the below line.
</Run>
</TextBlock>
One candidate would be the STATIC control.
Use the SS_LEFT style:
A simple rectangle and left-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line. Words that are longer than the width of the control are truncated.
The parent control is sent STN_CLICKED notifications when the control is clicked.
What you cannot do with a STATIC control is highlight some part of the text as shown in your screenshot. To achieve that you would likely need to use windowless rich edit controls.
I am new to Blend & Sketchflow. I hope someone can help me.
I have been doing a sketchflow project and have set up several buttons that navigate to specific screens (nice and easy).
Now the catch...
I have made a generic menu at the top, and have put a button on it, and what I want to achieve with it is that if someone clicks on that button, instead of navigating to a specific screen, it simply navigates to the previous screen that was viewed in sketchflow.
Does anyone know if this is possible? And if so, how I would achieve this?
Use the "back" behavior. There are 2 easy ways to apply this behavior to your button:
Right click the button in the artboard, select "Navigate To" -> "Back"
or
Open the assets panel, SketchFlow->Behaviors->NavigateBackAction, drag this behavior onto your button.
The xaml should look similar to this:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Microsoft.Expression.Prototyping.Behavior;assembly=Microsoft.Expression.Prototyping.Interactivity"
x:Class="SilverlightPrototype12Screens.Screen_1"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
<Button Height="66" Margin="241,68,275,0" VerticalAlignment="Top" Content="Button">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<pb:NavigateBackAction/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
I was looking for the same question, but I want to navigate from c#.net.
I found the following solution:
private void Navigate(object sender, RoutedEventArgs e)
{
Microsoft.Expression.Prototyping.Services.PlayerContext.Instance.ActiveNavigationViewModel.NavigateToScreen("WpfPrototype2Screens.Screen_2", true);
}
in this forum.