Solved

Using Resource Dictionary to assign height in Xaml

Posted on 2008-10-08
2
590 Views
Last Modified: 2013-11-26
Have a Resource Dictionary:
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!--    Grid Colors -->
    <Color x:Key="grdSolidColorBrush" A="255" R="165" G="195" B="239" />
          :
    <Button  x:Key="btnStd"    Height="23"  Width="75"  />
    <Label   x:Key="lblStd"    Height="28"  Width="54"  />
    <Label   x:Key="lblStd_X2" Height="28"  Width="108" />
    <TextBox x:Key="txtStd"    Height="21"  Width="90"  />
          :
    <Thickness x:Key="TxtR3C2" Left="265" Right="0" Bottom="0" Top="62"  />

Want to use the Resource Dictionary to globally assign height and width of GUI Objects

This works -
        <Grid >
            <Grid.Background>
                <SolidColorBrush Color="{DynamicResource grdSolidColorBrush}" />
            </Grid.Background>
and brings down the desired Color, in that way, can change the color in one location and cascade it to all Xaml code.  Can also place Objects dynamically on form with Margin="{DynamicResource TxtR3C2}" "like" commands.

However, I can not seem to dynamically control the height and width of Objects.  Width="{DynamicResource txtStd.Width}" does not produce an Object with a Width of 90.

What am I missing?

Thank you in advanced

Marv
0
Comment
Question by:Marvin_Rowe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Author Comment

by:Marvin_Rowe
ID: 22670492
Answered own question - sorry

This works for a Button control but it sould apply to all

    <Style TargetType="Button" x:Key="btnStd" >
        <Setter Property="Height" Value="28" />
        <Setter Property="Width" Value="54" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
    </Style>
0
 

Accepted Solution

by:
Marvin_Rowe earned 0 total points
ID: 22670499
That's "should" not "sould"
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question