<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[WPF: שגיאה בהגדרת סטייל]]></title><description><![CDATA[<p dir="auto">הגדרתי טמפלטים לגריד וwrappanel ועוד בקובץ App.xaml ולכל אחד נתתי x:key<br />
אח"כ בחלון מסוים תחת window.resource הגדרתי שהסטייל של האלמנטים הללו יהיה static resource ואת הKey שלהם.<br />
משום מה אני מקבל את השגיאה הנ"ל:<br />
Style object is not allowed to affect the Style property of the object to which it applies.</p>
<p dir="auto">מישו יודע מדוע ולמה?<br />
תודה רבה!</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב23/08/2015 23:24 (+03:00)</em></p>
]]></description><link>https://tchumim.com/topic/776/wpf-שגיאה-בהגדרת-סטייל</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 04:24:16 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/776.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Jan 2018 11:09:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WPF: שגיאה בהגדרת סטייל on Mon, 29 Jan 2018 11:10:00 GMT]]></title><description><![CDATA[<p dir="auto">אתה צריך לעשות כך:</p>
<pre><code>&lt;Style TargetType="WrapPanel" BasedOn="{StaticResource wrap}"/&gt;
</code></pre>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב25/08/2015 23:58 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4982</link><guid isPermaLink="true">https://tchumim.com/post/4982</guid><dc:creator><![CDATA[רחמים]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:10:00 GMT</pubDate></item><item><title><![CDATA[Reply to WPF: שגיאה בהגדרת סטייל on Mon, 29 Jan 2018 11:10:00 GMT]]></title><description><![CDATA[<p dir="auto">נניח אם אני מגדיר לwrappanel   את הkey="wrap"<br />
כך:</p>
<pre><code>&lt;Style TargetType="WrapPanel" x:Key="wrap" &gt;
            &lt;Setter Property="Margin" Value="5,0"/&gt;
            &lt;Setter Property="Orientation" Value="Vertical"/&gt;
            &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt;
            &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
        &lt;/Style&gt;
</code></pre>
<p dir="auto">ואח"כ באחד החלונות כותב:</p>
<pre><code>&lt;Grid.Resources&gt;
            &lt;Style TargetType="WrapPanel"&gt;
                &lt;Setter Property="Style" Value="{StaticResource wrap}"/&gt;
            &lt;/Style&gt;
</code></pre>
<p dir="auto">אז אני מקבל את השגיאה הבאה:</p>
<pre><code>Style object is not allowed to affect the Style property of the object to which it applies.
</code></pre>
<p dir="auto">תודה רבה</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב25/08/2015 20:52 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4981</link><guid isPermaLink="true">https://tchumim.com/post/4981</guid><dc:creator><![CDATA[avr416]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:10:00 GMT</pubDate></item><item><title><![CDATA[Reply to WPF: שגיאה בהגדרת סטייל on Mon, 29 Jan 2018 11:09:59 GMT]]></title><description><![CDATA[<p dir="auto">מעניין אצלי זה לא קורה, אולי תפרט יותר.</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב25/08/2015 00:30 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4980</link><guid isPermaLink="true">https://tchumim.com/post/4980</guid><dc:creator><![CDATA[רחמים]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:09:59 GMT</pubDate></item><item><title><![CDATA[Reply to WPF: שגיאה בהגדרת סטייל on Mon, 29 Jan 2018 11:09:59 GMT]]></title><description><![CDATA[<p dir="auto">בשמחה!</p>
<pre><code>&lt;Application.Resources&gt;
        &lt;Style TargetType="HeaderedContentControl" &gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="HeaderedContentControl"&gt;
                        &lt;Grid Margin="5,0"&gt;
                            &lt;Grid.ColumnDefinitions&gt;
                                &lt;ColumnDefinition SharedSizeGroup="col"/&gt;
                                &lt;ColumnDefinition/&gt;
                            &lt;/Grid.ColumnDefinitions&gt;
                            &lt;TextBlock Text="{TemplateBinding Header}" Foreground="Indigo" Margin="10,0"/&gt;
                            &lt;ContentPresenter Grid.Column="1"/&gt;
                            &lt;ContentPresenter Grid.Column="1"/&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
        &lt;/Style&gt;
        &lt;Style TargetType="TextBox"  &gt;
            &lt;Setter Property="VerticalAlignment" Value="Center" /&gt;
            &lt;Setter Property="Width" Value="120" /&gt;
        &lt;/Style&gt;
        &lt;Style TargetType="WrapPanel" &gt;
            &lt;Setter Property="Margin" Value="5,0"/&gt;
            &lt;Setter Property="Orientation" Value="Vertical"/&gt;
            &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt;
            &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
        &lt;/Style&gt;
        
        &lt;Style TargetType="Window"&gt;
            &lt;Setter Property="Background" Value="LightSteelBlue"/&gt;
        &lt;/Style&gt;
        &lt;Style TargetType="Button"&gt;
            &lt;Setter Property="Margin" Value="10,2"/&gt;
            &lt;Setter Property="Padding" Value="10,5"/&gt;
            &lt;Setter Property="FontWeight" Value="Bold"/&gt;
            &lt;Setter Property="FontSize" Value="14"/&gt;
        &lt;/Style&gt;
    &lt;/Application.Resources&gt;
</code></pre>
<p dir="auto">כאן זה אחרי שמחקתי את הkey שלהם, ואז הVS מזהה אוט' ומחיל את הסטיייל אוט' על כל מסכי האפליקציה.<br />
כך שבעצם ע"י זה אני עוקף את הבעיה.<br />
מצד שני, בתוכנה אחרת שניסיתי להשתמש בזה - זה לא עבד לי באופן אוט' ולכן בהתחלה ניסיתי להשתמש עכשיו בkey ואח"כ להפנות אליו מכל חלון, וקיבלתי את השגיאה הנ"ל.. אחרי שמחקתי את הKEY אז הוא זיהה לי באופן אוט'.<br />
תודה רבה!</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב24/08/2015 18:45 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4979</link><guid isPermaLink="true">https://tchumim.com/post/4979</guid><dc:creator><![CDATA[avr416]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:09:59 GMT</pubDate></item><item><title><![CDATA[Reply to WPF: שגיאה בהגדרת סטייל on Mon, 29 Jan 2018 11:09:59 GMT]]></title><description><![CDATA[<p dir="auto">תוכל להציג דוגמה של הסטייל? לאו דוקא דוגמה מלאה, רק מייצגת.</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב24/08/2015 18:34 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4978</link><guid isPermaLink="true">https://tchumim.com/post/4978</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:09:59 GMT</pubDate></item></channel></rss>