Solved

Using Resource Dictionary to assign height in Xaml

Posted on 2008-10-08
2
569 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now