I have a parent project and a child project. In the child project, I deleted all the classes (MainPage.xaml and its .cs file) and linked the Parent Project MainPage.xaml and its .cs file using Add as a link.
In my child project Project, I want to start a project using these project resource files (e.g. AppResources.resx). For example, I want to print a customized string value from AppResources.resx from a child project, I use this code in my xaml ..
<TextBlock x:Name="Txtblk" HorizontalAlignment="Left" Margin="56,147,0,0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding Path=LocalizedResources.ApplicationName, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top" Height="87" Width="155"/>
The code above prints the child name of the project.
I would like to achieve this by entering the code in my .cs file. Using the operator below, I can do this,
Txtblk.Text = AppResources.ApplicationTitle;
But for this I need to add the resources of the parent projects and return the values โโof the resource of the parent project ...
I want to use the binding principle like
Binding b = new Binding(); b.Source = LocalizedStrings; // How do I set this to {StaticResource LocalizedStrings} b.Path = new PropertyPath("LocalizedResources.ApplicationName"); b.Mode = BindingMode.OneWay; Txtblk.SetBinding(TextBlock.TextProperty, b);
How do I do this job?
Thanks.
source share