Using ReactiveUI V8+ RoutedViewHost in WPF - wpf

I am trying to upgrade my application template up to V8+. Previously working xaml seems to be broken. .NET Framework 4.7.2, ReactiveUI 8.3.1
<!--Client Area-->
<reactiveUi:RoutedViewHost x:Name="ViewHost"
Margin="3,9.667,3.333,3"
HorizontalAlignment="stretch"
VerticalAlignment="Stretch"
Grid.Row="1">
<reactiveUi:RoutedViewHost.DefaultContent>
<WrapPanel>
</WrapPanel>
</reactiveUi:RoutedViewHost.DefaultContent>
</reactiveUi:RoutedViewHost>
Gives a design-time warning:
"Don't know how to detect when Reactiveui.RoutedViewHost is activated/deactivated, you may need to implement IActivationFoViewFetcher". Am I missing a package or has there been a fundamental change in RoutedViewHost behavior?

There is a new nuget package called reactiveui.wpf that you need to include.
This will register a IActivationForViewFetcher.

Related

The resource could not be resolved. (DynamicResource)

I used this tutorial to implement a multilingual WPF application. Everything compiles, runs and works. But there is a problem: whenever I try to refer to a DynamicResource:
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource subtimer}" />
Visual Studio (2015) shows me a warning: The resource could not be resolved. It does not prevent working but it is just annoying and distracting (50 warnings for my smallest app).

How to create a simple tile in wpf?

How to create a simple tile in WPF, is there a native control? or it is absolutely necessary to install a package via nuget?
I saw that there was control: Tile Control but I can not find it in the toolbox
Thanks in advance
There is no built-in Tile control available in WPF.
You will have to create a custom yourself or use a third-party control.
There are free open-source options available, like for example the mahapps.metro Tile control: http://mahapps.com/controls/tile.html. It does of course require you to install mahapps.metro (preferably using NuGet) though: http://mahapps.com/guides/quick-start.html
add these namespace in a page or window xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro".By this,we can use tile in mahapps
<mah:Tile ToolTip="Tile" Width="90" Height="50" Click="GetTileDetails" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontFamily="Times New Roman" FontSize="22" >
<TextBlock Text="Text" ></TextBlock></mah:Tile>

Why does my app ignore certain xaml code on Windows 7?

I'm creating a WPF C# .Net App with the Aero theme which is supposed to run on Win7 as well as Win10.
On Win10 everything works as it's supposed to, however on Win7 the GUI looks vastly different.
In particular, my MenuItems simply seem to ignore certain settings such as VerticalContentAlignmentand BorderThickness.
Pics:
Win7 vs
Win10
How do I fix this?
(Some Code:)
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
<MenuItem Header="Intranet"
Grid.Column="2"
x:Name="Menu_Intranet"
ToolTip="Intranet"
BorderBrush="white"
BorderThickness="5"
VerticalAlignment="Stretch"
Click="Menu_1_Click"
ToolTipService.ShowOnDisabled="true"
VerticalContentAlignment="Center"/>
Thanks in advance!
I edited the MenuItemControlTemplate (right click on the control you want to edit in the designer -> edit template) and applied it to the MenuItems via Template="{DynamicResource MyMenuItemControlTemplate}".
I guess this leaves no room for the OS/Theme to apply its own settings.

Why does Visual Studio prompt error in XAML when I use Label?

I use Visual Studio 2012, and wrote some XAML(of WPF) code, just like this:
<StackPanel>
<Label Target="txt">UserName:</Label>
<TextBox Name="txt"></TextBox>
</StackPanel>
then, the compilation failed. It said to Label related-code,
Value cannot be null. Parameter name: context.
I don't know its meaning. Did I miss anything?
It is a designer-only error. Code should compile without any issue.
EDIT: This exception is due to Silverlight not supporting this syntax : Target="txt". this syntax is only supported by WPF. It's a known bug in the designer, even if your project is a WPF project, and was caused by MS wanting to support design-time checks for Silverlight.
If you don't want the exception you have to use the full binding syntax (supported by WPF and Silverlight)
<Label Target="{Binding ElementName=txt}">UserName:</Label>

Silverlight DataForm Memory Leak

Some Background
I have noticed that setting the EditTemplate of a DataForm (from the Silverlight Toolkit) can cause the DataForm to not be garbage collected. Consequently, the parent control of the DataForm cannot be garbage collected either, causing a very significant memory leak.
Here's some XAML which demonstrates the case.
<toolkit:DataForm HorizontalAlignment="Stretch" Margin="10" VerticalAlignment="Stretch">
<toolkit:DataForm.EditTemplate>
<DataTemplate>
<toolkit:DataField Label="Dummy Binding:">
<TextBox Text="{Binding DummyBinding, Mode=TwoWay}" />
</toolkit:DataField>
</DataTemplate>
</toolkit:DataForm.EditTemplate>
</toolkit:DataForm>
I have opened an issue on CodePlex. The isssue has an attachment which has a project which desmonstrates the case.
So, My Question Is
Has anyone else encountered this issue? More importantly, does anyone know of any workarounds? How can I force this DataForm to be garbage collected?
FYI, to anyone concerned about this issue... MS released a fix for this.
Silverlight 4 Service Release
It turns out that this issue is not specific to the DataForm control, and that it is actually a problem with the Silverlight 4 runtime. All built-in controls and user controls that use a DataTemplate have this issue as discussed in greater detail in this thread. Tim Heuer (the Silverlight Program Manager) is responsive on the thread and proposes a possible workaround with mixed results. He does mention that they already have a fix entered into testing, so hopefully an update should be released relatively soon.

Resources