How can I access a resource when it's declared as a Class in C# back end?

前端 未结 1 1711
情深已故
情深已故 2021-01-24 11:21

My main resources look like this:




        
1条回答
  •  走了就别回头了
    2021-01-24 11:53

    You can use the TryGetValue to obtain a single from your ResourceDictionary:

    if (Application.Current.Resources.TryGetValue("DetailLabel", out object style))
    {
        someLabel.Style = (Style)style;
    }
    

    0 讨论(0)
提交回复
热议问题