English 中文(简体)
银根资源问题
原标题:Silverlight ResourceDictionary problem

我有报告说,我用xaml页界定了一些地方资源。

<UserControl.Resources>
<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries >
        <ResourceDictionary Source="/My.Namespace;component/Resources/Converters.xaml" />
        <ResourceDictionary Source="/My.Namespace;component/Resources/GlobResources.xaml" />
        <ResourceDictionary Source="/My.Namespace;component/Resources/ReportingResources.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

在同一份报告中。 xaml file I have content control such...

<ContentControl
Content="{Binding}"
ContentTemplate="{Binding Converter={StaticResource reportTemplateSelector}, Path=CurrReportType}"
Margin="0"
/>

我现在转手把报告资源装上我。 具有以下编码线的Xaml资源档案

ResourceDictionary reportTemplate = new ResourceDictionary();
reportTemplate.Source = new Uri("/My.Namespace;component/Resources/ReportingResources.xaml", UriKind.Relative);
template = reportTemplate[Report_Style] as DataTemplate;
return template;

“报告”实际上将成为一种变数,在使用上述线之前,将采用报告TemplateSelector换算器的垂直方法。

这里的问题是报告资源。 xaml依靠GlobResources。 其他部分的xaml资源档案。 我如何将GlobResources.xaml的内容提供给报告资源。 xaml file in the Line of Code above?

感谢您的时间......

问题回答

您是否尝试了。

资源档案可以合并其他资源档案:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ResourceB.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Name="MyButtonStyle" TargetType="Button">
        <Setter Property="Background" Value="red"/>
    </Style>

</ResourceDictionary>

摘自Silverlight 3,0 Split风格和模板进入不同档案和合并资源





相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签