Closed anv1l closed 7 months ago
Hallo, you have some options here. Short : if you use the Custom UI you have access to each Dialog and here you can just replace Placeholder to your string Title, thats it.
Long Version : Each Dialog , if it WPF and C#, can be bound to Property of Title and UI / View map Title to Property and you can only change this Property and your Titlename will be change automatically. In Template of Wix# WPF C# Oleg use Caliburn.Micro Framework. If you new to this type, check MVVM Tutorials and i can only recommended also look for CommunityToolKit.MVVM from MS. Is easy , nice to handle and for beginner easier to understand.
Some Link for MVVM :
and for learn https://www.tutorialspoint.com/mvvm/index.htm, for understanding.
Best regards, Torchok.
Yes, this can be done when you inherit from WpfDialog. What I am curious is how this can be done when you don't use that, for example in sample CustomUIDialog.WPF with CustomDialogPanel : UserControl, IWpfDialogContent.
just looked myself tosample CustomUIDialog.WPF. Example use already MVVM Framework. This is Caliburn.Micro. You can create string Property and bind Title to it.
private stirng _title;
public string TitleText
{
get { return _title; }
set
{
_title = value;
}
}
in C# code and add into UserControl TextBlock on top of him something like TextBlock Text = "{Binding TitleText }". Has to be something like this, because usercontrol doesnt has property Title like WPF Window.
I can bind wpf elements, but the title and description comes from managed form host?
and may i ask, why you want to use usercontrols for WPF UI and not standard WPF UI from Template of Wix# ?
So from that sample. The user control part is wpf, which works as expected.
No other particular reason, other than following the more simple implementation from samples. But looks like it's not really an option.
AFAIK oleq self suggest always to use Custom UI Template of v3 or V4 for WPF if you want to maximaze your flexibility for build UI and MSI, whatever you want Bootstrapper Application or MSI embeded in it. I had near ~90% installers with template and this works always.
Yeah, seems so. However, if you are left with above default texts, the sample is not really usable in any scenario, might be an idea to just remove it.
maybe. But for some unknown reason, @oleg-shilo created it and add it to samples.
You can always use VS templates to have the dialogs source. Then you can just modify them and even remove Caliburn autobinding completely.
This is how autobiding implemented now. It's dome entirely from XAML: Because the text block content is enclosed in square brackets. WixSharp knows that it needs to treat the bracketed content as n MSI property name and resolve it.
If ou prefer to set it manually you simply give the TextBlock name in XAML and then set its value from codebehid:
<TextBlock
x:Name="titleLabel"
Grid.RowSpan="1"
Grid.Column="1"
Margin="10,25,10,10"
VerticalAlignment="Top"
Background="White"
FontSize="16"
FontWeight="Normal"/>
and then in WelcomeDialog.xaml.cs:
public WelcomeDialog()
{
InitializeComponent();
titleLabel.Text = "whatever";
}
This is now just a generic WPF routine.
Thanks for input. If you put this in the context of sample CustomUIDialog.WPF / CustomDialogPanel.xaml how do you change the marked texts, that come from windows forms host I believe.
@anv1l, the code sample you are asking about specifically demonstrates how to provide minimalistic content of a custom dialog without changing any UI elements shared with other dialogs (e.g. dialog title or description label).
And yet it is exactly what you are trying to do - customize that shared content. That's you are much better off by using the custom UI VS template where you have access to all UI elements including the ones that you specifically mentioned (title and description label).
I am not sure if I could have been more clear; it's in the issue topic already. I was only asking if the title and description could be changed when using CustomDialogWith
I did not think it would make sense to have that feature without being able to change those values and assumed you could change them somehow - and avoid modifying my installer solution to work with WpfDialog.
Appologies, I indeed misunderstood what you are trying to do.
And indeed the sample were discussing does not explain how to control the localization of the custom dialog content.
What you need to do is to add the new content to the localization data. Either with the WXL file or dynamically at runtime.
project.UIInitialized += e =>
{
// Since the default MSI localization data has no entry for 'CustomDlgTitle' (and other custom labels) we
// need to add this new content dynamically. Alternatively, you can use WiX localization files (wxl).
MsiRuntime runtime = e.ManagedUI.Shell.MsiRuntime();
runtime.UIText["CustomDlgTitle"] = "My Custom Dialog";
runtime.UIText["CustomDlgTitleDescription"] = "My Custom Dialog Description";
};
I have updated the sample to reflect on how to do that:
Most likely silly question but... well, the title says it all. Now I just get the default placesholder values.