路径未显示在wpf中

时间:2014-03-06 00:47:43

标签: c# sql-server wpf entity-framework xaml

我有一个ListBox,如:

<ListBox........>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal" Height="125" Width="250">
                <Path Data="M30.373745,48.782903 L34.061225,52.334534 31.195886,55.092382 34.153223,58.390248 30.240102,69.677123 26.208671,58.520078 29.50873,55.051745 26.683462,52.334534 z M45.929993,48.400234 C54.993983,50.039733 61.855001,57.69262 61.855001,66.890767 L61.855001,74.228456 0,74.228456 0,66.890767 C0,57.772108 6.741145,50.166745 15.688139,48.441349 L30.12067,70.215768 z M25.578545,16.688857 C23.65094,16.684204 21.220639,17.161782 20.935762,19.541124 20.935762,19.541124 C41.752938,28.634368 41.270957,24.164315 40.791351,22.315548 L40.470759,17.846459 C40.470759,17.846459 37.749578,15.688086 33.746217,17.537994 33.746217,17.537994 29.101681,17.382664 27.980984,16.920977 27.980984,16.920977 26.897432,16.692041 25.578545,16.688857 z M31.058608,7.9694567 C36.517556,7.9690171 40.31132,10.755741 40.31132,10.755741 47.356468,16.150166 43.51454,25.397617 43.51454,25.397617 45.114914,26.321945 44.955899,27.092082 44.955899,27.092082 44.955899,37.110899 42.073269,36.339536 42.073269,36.339536 40.470519,42.812609 34.228024,45.740028 34.228024,45.740028 22.056509,48.668684 19.014952,36.493806 19.014952,36.493806 16.452816,36.185347 16.132321,30.483463 16.132321,30.483463 15.32967,26.630488 17.573592,25.089074&#xd;&#xa;17.573591,25.089074 12.767717,14.301431 21.415519,11.065428 21.415519,11.065429 24.882823,8.7346496 28.19916,7.9696873 31.058608,7.9694567 z M102.65546,2.2428111E-07 L132.62833,2.2428111E-07 C132.79703,0.015760289 132.88041,0.074689228 132.88041,0.17815748 L132.88041,2.1694074 C132.88041,2.2879505 132.79703,2.3468795 132.62833,2.3468795 L121.34853,2.3468795 121.34853,2.5236663 C122.95419,3.129401 124.20085,4.3682791 125.08754,6.2423564 L125.21407,6.8844078 132.62833,6.8844078 C132.79703,6.8987974 132.88041,6.9577264 132.88041,7.0611946 L132.88041,9.0524446 C132.88041,9.1716729 132.79703,9.2299166 132.62833,9.2299166 L125.49852,9.2299166 C125.49852,11.458253 123.54564,13.62766 119.63793,15.737453 116.17356,17.125024 113.71358,17.818467 112.25506,17.818467 112.25506,17.877396 112.17169,17.90686 112.00298,17.90686 L128.09679,32.470531 128.09679,32.648003 121.98314,32.648003 C121.91939,32.648003 115.69785,27.011381 103.32146,15.737453 L103.32146,15.64906 105.25374,15.64906 C112.09714,15.64906 116.20495,13.930527 117.57814,10.492092 117.66249,10.078904 117.70467,9.7472579 117.70467,9.4957821 L117.70467,9.2299166 102.65546,9.2299166 C102.48676,9.2299166 102.4024,9.1716729 102.4024,9.0524446 L102.4024,7.0611946 C102.423,6.9433367 102.50735,6.8844078 102.65546,6.8844078 L117.57814,6.8844078 C117.07202,5.5420614 115.99406,4.4491351 114.34721,3.6083699 112.06477,2.7669195 109.98537,2.3468795 108.10507,2.3468795 L102.65546,2.3468795 C102.48676,2.3468795 102.4024,2.2879505 102.4024,2.1694074 L102.4024,0.17815748 C102.423,0.059614384 102.50735,2.2428111E-07 102.65546,2.2428111E-07 z M108.14659,48.929507 C108.60258,48.991774 109.04681,49.141183 109.36937,49.363049 L115.81339,53.795493 C116.45843,54.240077 116.38944,54.823783 115.65763,55.094693 L108.4344,57.770352 C107.70384,58.041421 106.60199,57.871593 105.98716,57.393159 L99.9046,52.666692 C99.290227,52.188297 99.390153,51.589703 100.12753,51.335543 L106.85324,49.018828 C107.22285,48.89212 107.6906,48.867242 108.14659,48.929507 z M116.1849,64.313321 C115.92341,64.653389 115.58309,64.94123 115.22663,65.094721 L108.10545,68.161015 C107.39176,68.467501 106.06313,68.211203 106.12515,67.483853 L107.53189,60.218189 C107.59321,59.49177 108.24373,58.679514 108.97672,58.414146 L116.22178,55.785567 C116.95453,55.520553 117.48765,55.894865 117.40702,56.618542 L116.6701,63.218556 C116.62902,63.580956 116.44638,63.973252 116.1849,64.313321 z M97.413327,62.406376 C97.237591,62.012556 97.150618,61.587373 97.195072,61.225596 L98.083245,53.998148 C98.173009,53.274272 98.762534,53.056366 99.39653,53.514899 L105.65592,58.04004 C106.28943,58.497505 106.6957,59.45819 106.55825,60.173748 L105.20487,67.249664 C105.06723,67.964837 104.44764,68.164968 103.82667,67.694143 L98.16417,63.398968 C97.853566,63.16265 97.589065,62.800195 97.413327,62.406376 z M126.78569,63.810287 C127.22452,63.945806 127.6348,64.164732 127.91072,64.434719 L133.42292,69.828487 C133.9745,70.369279 133.79304,70.929568 133.01683,71.075206 L125.35508,72.514344 C124.58007,72.660342 123.52346,72.31391 123.00831,71.74491 L117.91059,66.122327 C117.39589,65.553439 117.61083,64.983629 118.38929,64.855303 L125.48945,63.68631 C125.87951,63.62266 126.34687,63.67477 126.78569,63.810287 z M131.7497,80.188338 C131.42516,80.478586 131.03278,80.704803 130.65053,80.796827 L123.01388,82.63516 C122.2487,82.818596 120.98461,82.350418 121.18705,81.648332 L123.98772,74.763734 C124.18929,74.062445 124.99014,73.373429 125.76644,73.233412 L133.44065,71.843943 C134.21664,71.704233 134.6712,72.157918 134.45107,72.853365 L132.44189,79.19566 C132.33096,79.543809 132.07424,79.898088 131.7497,80.188338 z M113.5575,75.252196 C113.46013,74.837836 113.45662,74.407275 113.57076,74.060288 L115.85124,67.128333 C116.08044,66.434185 116.70566,66.317188 117.24363,66.869834 L122.55527,72.324188 C123.09296,72.875708 123.30831,73.882835 123.03357,74.561043 L120.32248,81.268562 C120.04762,81.94636 119.39611,82.041039 118.87342,81.478486 L114.10739,76.346899 C113.8461,76.064715 113.65487,75.666556 113.5575,75.252196 z M101.91388,67.510834 C102.37301,67.50897 102.83501,67.595236 103.18925,67.770401 L110.26623,71.269876 C110.97477,71.621065 111.00358,72.210021 110.32818,72.581068 L103.66197,76.24510793.582501,82.38503 z M91.36911,16.709103 L83.027861,11.377728 L83.780329,14.795884 L63.271393,19.310696 L64.77633,26.147008 L85.285267,21.632196 L86.037735,25.050353 z M63.159544,51.366148 L68.646617,59.605811 L69.334764,56.174127 L89.924866,60.303012 L91.301161,53.439645 L70.711059,49.31076 L71.399207,45.879076 z"  VerticalAlignment="Center" 
                      Stretch="Uniform" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"
                      Width="68" Height="68" Margin="10" RenderTransformOrigin="0.5,0.5">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <TransformGroup.Children>
                                <RotateTransform Angle="0" />
                                <ScaleTransform ScaleX="1" ScaleY="1" />
                            </TransformGroup.Children>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
                <TextBlock Text="{Binding Title, Converter={StaticResource spaceToNewLineConverter}}" VerticalAlignment="Top" 
                           Margin="40,10,10,10" FontSize="24" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"/>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

以上代码完美无缺。

这是输出:

enter image description here

现在,如果我用下面的Binding替换path元素中的数据:

<Path Data="{Binding ImageData}" .........../>

它没有显示任何内容。这是输出:

enter image description here

但是其他图块显示具有上述绑定的图像。

在这里你可以看到:

enter image description here

我已将所有这些路径存储在数据库中。我确信我已经在数据库中存储了正确的购买路径值。此外,如果我在textBox上设置相同的绑定,那么它获取的值。但我在路径元素中看不到任何内容。此外,数据库中的字段为datatype = nvarchar(max)。所以,我的字符串没有被截断。对于其他路径,字符串长度接近约3000-5000但是对于此路径,字符串长度约为8000.因此,我认为WPF对路径或其他内容有一些字符串长度限制。

我正在寻找解决方案。

注意:我正在使用实体框架来生成我的模型。

更新

我在blend中为数据元素创建了上面的字符串。现在我将这些字符串比较如下:

string blend = "M30.373745,48.782903 L34.061225,52.334534 31.195886,55.092382 34.153223,58.390248 30.240102,69.677123 26.208671,58.520078 29.50873,55.051745 26.683462,52.334534 z M45.929993,48.400234 C54.993983,50.039733 61.855001,57.69262 61.855001,66.890767 L61.855001,74.228456 0,74.228456 0,66.890767 C0,57.772108 6.741145,50.166745 15.688139,48.441349 L30.12067,70.215768 z M25.578545,16.688857 C23.65094,16.684204 21.220639,17.161782 20.935762,19.541124 20.935762,19.541124 20.935762,24.164315 19.653679,24.781329 L19.335459,29.096056 18.053283,27.863076 18.53289,33.719246 20.935762,33.874751 C20.935762,33.874751 21.576943,45.740047 33.266517,43.429592 33.266517,43.429592 38.870365,41.733872 40.150172,33.874751 L42.073525,33.719246 42.553134,28.47904 41.752938,28.634368 C41.752938,28.634368 41.270957,24.164315 40.791351,22.315548 L40.470759,17.846459 C40.470759,17.846459 37.749578,15.688086 33.746217,17.537994 33.746217,17.537994 29.101681,17.382664 27.980984,16.920977 27.980984,16.920977 26.897432,16.692041 25.578545,16.688857 z M31.058608,7.9694567 C36.517556,7.9690171 40.31132,10.755741 40.31132,10.755741 47.356468,16.150166 43.51454,25.397617 43.51454,25.397617 45.114914,26.321945 44.955899,27.092082 44.955899,27.092082 44.955899,37.110899 42.073269,36.339536 42.073269,36.339536 40.470519,42.812609 34.228024,45.740028 34.228024,45.740028 22.056509,48.668684 19.014952,36.493806 19.014952,36.493806 16.452816,36.185347 16.132321,30.483463 16.132321,30.483463 15.32967,26.630488 17.573592,25.089074&#xd;&#xa;17.573591,25.089074 12.767717,14.301431 21.415519,11.065428 21.415519,11.065429 24.882823,8.7346496 28.19916,7.9696873 31.058608,7.9694567 z M102.65546,2.2428111E-07 L132.62833,2.2428111E-07 C132.79703,0.015760289 132.88041,0.074689228 132.88041,0.17815748 L132.88041,2.1694074 C132.88041,2.2879505 132.79703,2.3468795 132.62833,2.3468795 L121.34853,2.3468795 121.34853,2.5236663 C122.95419,3.129401 124.20085,4.3682791 125.08754,6.2423564 L125.21407,6.8844078 132.62833,6.8844078 C132.79703,6.8987974 132.88041,6.9577264 132.88041,7.0611946 L132.88041,9.0524446 C132.88041,9.1716729 132.79703,9.2299166 132.62833,9.2299166 L125.49852,9.2299166 C125.49852,11.458253 123.54564,13.62766 119.63793,15.737453 116.17356,17.125024 113.71358,17.818467 112.25506,17.818467 112.25506,17.877396 112.17169,17.90686 112.00298,17.90686 L128.09679,32.470531 128.09679,32.648003 121.98314,32.648003 C121.91939,32.648003 115.69785,27.011381 103.32146,15.737453 L103.32146,15.64906 105.25374,15.64906 C112.09714,15.64906 116.20495,13.930527 117.57814,10.492092 117.66249,10.078904 117.70467,9.7472579 117.70467,9.4957821 L117.70467,9.2299166 102.65546,9.2299166 C102.48676,9.2299166 102.4024,9.1716729 102.4024,9.0524446 L102.4024,7.0611946 C102.423,6.9433367 102.50735,6.8844078 102.65546,6.8844078 L117.57814,6.8844078 C117.07202,5.5420614 115.99406,4.4491351 114.34721,3.6083699 112.06477,2.7669195 109.98537,2.3468795 108.10507,2.3468795 L102.65546,2.3468795 C102.48676,2.3468795 102.4024,2.2879505 102.4024,2.1694074 L102.4024,0.17815748 C102.423,0.059614384 102.50735,2.2428111E-07 102.65546,2.2428111E-07 z M108.14659,48.929507 C108.60258,48.991774 109.04681,49.141183 109.36937,49.363049 L115.81339,53.795493 C116.45843,54.240077 116.38944,54.823783 115.65763,55.094693 L108.4344,57.770352 C107.70384,58.041421 106.60199,57.871593 105.98716,57.393159 L99.9046,52.666692 C99.290227,52.188297 99.390153,51.589703 100.12753,51.335543 L106.85324,49.018828 C107.22285,48.89212 107.6906,48.867242 108.14659,48.929507 z M116.1849,64.313321 C115.92341,64.653389 115.58309,64.94123 115.22663,65.094721 L108.10545,68.161015 C107.39176,68.467501 106.06313,68.211203 106.12515,67.483853 L107.53189,60.218189 C107.59321,59.49177 108.24373,58.679514 108.97672,58.414146 L116.22178,55.785567 C116.95453,55.520553 117.48765,55.894865 117.40702,56.618542 L116.6701,63.218556 C116.62902,63.580956 116.44638,63.973252 116.1849,64.313321 z M97.413327,62.406376 C97.237591,62.012556 97.150618,61.587373 97.195072,61.225596 L98.083245,53.998148 C98.173009,53.274272 98.762534,53.056366 99.39653,53.514899 L105.65592,58.04004 C106.28943,58.497505 106.6957,59.45819 106.55825,60.173748 L105.20487,67.249664 C105.06723,67.964837 104.44764,68.164968 103.82667,67.694143 L98.16417,63.398968 C97.853566,63.16265 97.589065,62.800195 97.413327,62.406376 z M126.78569,63.810287 C127.22452,63.945806 127.6348,64.164732 127.91072,64.434719 L133.42292,69.828487 C133.9745,70.369279 133.79304,70.929568 133.01683,71.075206 L125.35508,72.514344 C124.58007,72.660342 123.52346,72.31391 123.00831,71.74491 L117.91059,66.122327 C117.39589,65.553439 117.61083,64.983629 118.38929,64.855303 L125.48945,63.68631 C125.87951,63.62266 126.34687,63.67477 126.78569,63.810287 z M131.7497,80.188338 C131.42516,80.478586 131.03278,80.704803 130.65053,80.796827 L123.01388,82.63516 C122.2487,82.818596 120.98461,82.350418 121.18705,81.648332 L123.98772,74.763734 C124.18929,74.062445 124.99014,73.373429 125.76644,73.233412 L133.44065,71.843943 C134.21664,71.704233 134.6712,72.157918 134.45107,72.853365 L132.44189,79.19566 C132.33096,79.543809 132.07424,79.898088 131.7497,80.188338 z M113.5575,75.252196 C113.46013,74.837836 113.45662,74.407275 113.57076,74.060288 L115.85124,67.128333 C116.08044,66.434185 116.70566,66.317188 117.24363,66.869834 L122.55527,72.324188 C123.09296,72.875708 123.30831,73.882835 123.03357,74.561043 L120.32248,81.268562 C120.04762,81.94636 119.39611,82.041039 118.87342,81.478486 L114.10739,76.346899 C113.8461,76.064715 113.65487,75.666556 113.5575,75.252196 z M101.91388,67.510834 C102.37301,67.50897 102.83501,67.595236 103.18925,67.770401 L110.26623,71.269876 C110.97477,71.621065 111.00358,72.210021 110.32818,72.581068 L103.66197,76.245107 C102.98782,76.616139 101.87517,76.601422 101.19075,76.21242 L94.420833,72.370663 C93.736869,71.981636 93.736043,71.373586 94.419702,71.018385 L100.6557,67.780056 C100.99849,67.602696 101.45476,67.5127 101.91388,67.510834 z M112.37454,81.656858 C112.17351,82.030879 111.88624,82.364073 111.56082,82.566176 L105.05978,86.603671 C104.4081,87.007498 103.05792,86.938622 102.99845,86.208073 L103.17924,78.800567 C103.11923,78.071041 103.62493,77.174063 104.30242,76.808351 L110.99791,73.18799 C111.67522,72.822663 112.26197,73.119732 112.30251,73.849232 L112.67071,80.50257 C112.69032,80.867986 112.57556,81.282833 112.37454,81.656858 z M93.582501,82.38503 C93.344281,82.018702 93.18823,81.608855 93.172043,81.243588 L92.848752,73.94641 C92.817167,73.215437 93.361308,72.916861 94.061297,73.283435 L100.97191,76.900689 C101.67124,77.266271 102.23029,78.163021 102.21356,78.892395 L102.05386,86.104129 C102.03688,86.833149 101.4602,87.118281 100.771,86.737686 L94.485983,83.265339 C94.141114,83.074158 93.820723,82.751354 93.582501,82.38503 z M91.36911,16.709103 L83.027861,11.377728 L83.780329,14.795884 L63.271393,19.310696 L64.77633,26.147008 L85.285267,21.632196 L86.037735,25.050353 z M63.159544,51.366148 L68.646617,59.605811 L69.334764,56.174127 L89.924866,60.303012 L91.301161,53.439645 L70.711059,49.31076 L71.399207,45.879076 z";
string database = "M30.373745,48.782903 L34.061225,52.334534 31.195886,55.092382 34.153223,58.390248 30.240102,69.677123 26.208671,58.520078 29.50873,55.051745 26.683462,52.334534 z M45.929993,48.400234 C54.993983,50.039733 61.855001,57.69262 61.855001,66.890767 L61.855001,74.228456 0,74.228456 0,66.890767 C0,57.772108 6.741145,50.166745 15.688139,48.441349 L30.12067,70.215768 z M25.578545,16.688857 C23.65094,16.684204 21.220639,17.161782 20.935762,19.541124 20.935762,19.541124 20.935762,24.164315 19.653679,24.781329 L19.335459,29.096056 18.053283,27.863076 18.53289,33.719246 20.935762,33.874751 C20.935762,33.874751 21.576943,45.740047 33.266517,43.429592 33.266517,43.429592 38.870365,41.733872 40.150172,33.874751 L42.073525,33.719246 42.553134,28.47904 41.752938,28.634368 C41.752938,28.634368 41.270957,24.164315 40.791351,22.315548 L40.470759,17.846459 C40.470759,17.846459 37.749578,15.688086 33.746217,17.537994 33.746217,17.537994 29.101681,17.382664 27.980984,16.920977 27.980984,16.920977 26.897432,16.692041 25.578545,16.688857 z M31.058608,7.9694567 C36.517556,7.9690171 40.31132,10.755741 40.31132,10.755741 47.356468,16.150166 43.51454,25.397617 43.51454,25.397617 45.114914,26.321945 44.955899,27.092082 44.955899,27.092082 44.955899,37.110899 42.073269,36.339536 42.073269,36.339536 40.470519,42.812609 34.228024,45.740028 34.228024,45.740028 22.056509,48.668684 19.014952,36.493806 19.014952,36.493806 16.452816,36.185347 16.132321,30.483463 16.132321,30.483463 15.32967,26.630488 17.573592,25.089074&#xd;&#xa;17.573591,25.089074 12.767717,14.301431 21.415519,11.065428 21.415519,11.065429 24.882823,8.7346496 28.19916,7.9696873 31.058608,7.9694567 z M102.65546,2.2428111E-07 L132.62833,2.2428111E-07 C132.79703,0.015760289 132.88041,0.074689228 132.88041,0.17815748 L132.88041,2.1694074 C132.88041,2.2879505 132.79703,2.3468795 132.62833,2.3468795 L121.34853,2.3468795 121.34853,2.5236663 C122.95419,3.129401 124.20085,4.3682791 125.08754,6.2423564 L125.21407,6.8844078 132.62833,6.8844078 C132.79703,6.8987974 132.88041,6.9577264 132.88041,7.0611946 L132.88041,9.0524446 C132.88041,9.1716729 132.79703,9.2299166 132.62833,9.2299166 L125.49852,9.2299166 C125.49852,11.458253 123.54564,13.62766 119.63793,15.737453 116.17356,17.125024 113.71358,17.818467 112.25506,17.818467 112.25506,17.877396 112.17169,17.90686 112.00298,17.90686 L128.09679,32.470531 128.09679,32.648003 121.98314,32.648003 C121.91939,32.648003 115.69785,27.011381 103.32146,15.737453 L103.32146,15.64906 105.25374,15.64906 C112.09714,15.64906 116.20495,13.930527 117.57814,10.492092 117.66249,10.078904 117.70467,9.7472579 117.70467,9.4957821 L117.70467,9.2299166 102.65546,9.2299166 C102.48676,9.2299166 102.4024,9.1716729 102.4024,9.0524446 L102.4024,7.0611946 C102.423,6.9433367 102.50735,6.8844078 102.65546,6.8844078 L117.57814,6.8844078 C117.07202,5.5420614 115.99406,4.4491351 114.34721,3.6083699 112.06477,2.7669195 109.98537,2.3468795 108.10507,2.3468795 L102.65546,2.3468795 C102.48676,2.3468795 102.4024,2.2879505 102.4024,2.1694074 L102.4024,0.17815748 C102.423,0.059614384 102.50735,2.2428111E-07 102.65546,2.2428111E-07 z M108.14659,48.929507 C108.60258,48.991774 109.04681,49.141183 109.36937,49.363049 L115.81339,53.795493 C116.45843,54.240077 116.38944,54.823783 115.65763,55.094693 L108.4344,57.770352 C107.70384,58.041421 106.60199,57.871593 105.98716,57.393159 L99.9046,52.666692 C99.290227,52.188297 99.390153,51.589703 100.12753,51.335543 L106.85324,49.018828 C107.22285,48.89212 107.6906,48.867242 108.14659,48.929507 z M116.1849,64.313321 C115.92341,64.653389 115.58309,64.94123 115.22663,65.094721 L108.10545,68.161015 C107.39176,68.467501 106.06313,68.211203 106.12515,67.483853 L107.53189,60.218189 C107.59321,59.49177 108.24373,58.679514 108.97672,58.414146 L116.22178,55.785567 C116.95453,55.520553 117.48765,55.894865 117.40702,56.618542 L116.6701,63.218556 C116.62902,63.580956 116.44638,63.973252 116.1849,64.313321 z M97.413327,62.406376 C97.237591,62.012556 97.150618,61.587373 97.195072,61.225596 L98.083245,53.998148 C98.173009,53.274272 98.762534,53.056366 99.39653,53.514899 L105.65592,58.04004 C106.28943,58.497505 106.6957,59.45819 106.55825,60.173748 L105.20487,67.249664 C105.06723,67.964837 104.44764,68.164968 103.82667,67.694143 L98.16417,63.398968 C97.853566,63.16265 97.589065,62.800195 97.413327,62.406376 z M126.78569,63.810287 C127.22452,63.945806 127.6348,64.164732 127.91072,64.434719 L133.42292,69.828487 C133.9745,70.369279 133.79304,70.929568 133.01683,71.075206 L125.35508,72.514344 C124.58007,72.660342 123.52346,72.31391 123.00831,71.74491 L117.91059,66.122327 C117.39589,65.553439 117.61083,64.983629 118.38929,64.855303 L125.48945,63.68631 C125.87951,63.62266 126.34687,63.67477 126.78569,63.810287 z M131.7497,80.188338 C131.42516,80.478586 131.03278,80.704803 130.65053,80.796827 L123.01388,82.63516 C122.2487,82.818596 120.98461,82.350418 121.18705,81.648332 L123.98772,74.763734 C124.18929,74.062445 124.99014,73.373429 125.76644,73.233412 L133.44065,71.843943 C134.21664,71.704233 134.6712,72.157918 134.45107,72.853365 L132.44189,79.19566 C132.33096,79.543809 132.07424,79.898088 131.7497,80.188338 z M113.5575,75.252196 C113.46013,74.837836 113.45662,74.407275 113.57076,74.060288 L115.85124,67.128333 C116.08044,66.434185 116.70566,66.317188 117.24363,66.869834 L122.55527,72.324188 C123.09296,72.875708 123.30831,73.882835 123.03357,74.561043 L120.32248,81.268562 C120.04762,81.94636 119.39611,82.041039 118.87342,81.478486 L114.10739,76.346899 C113.8461,76.064715 113.65487,75.666556 113.5575,75.252196 z M101.91388,67.510834 C102.37301,67.50897 102.83501,67.595236 103.18925,67.770401 L110.26623,71.269876 C110.97477,71.621065 111.00358,72.210021 110.32818,72.581068 L103.66197,76.245107 C102.98782,76.616139 101.87517,76.601422 101.19075,76.21242 L94.420833,72.370663 C93.736869,71.981636 93.736043,71.373586 94.419702,71.018385 L100.6557,67.780056 C100.99849,67.602696 101.45476,67.5127 101.91388,67.510834 z M112.37454,81.656858 C112.17351,82.030879 111.88624,82.364073 111.56082,82.566176 L105.05978,86.603671 C104.4081,87.007498 103.05792,86.938622 102.99845,86.208073 L103.17924,78.800567 C103.11923,78.071041 103.62493,77.174063 104.30242,76.808351 L110.99791,73.18799 C111.67522,72.822663 112.26197,73.119732 112.30251,73.849232 L112.67071,80.50257 C112.69032,80.867986 112.57556,81.282833 112.37454,81.656858 z M93.582501,82.38503 C93.344281,82.018702 93.18823,81.608855 93.172043,81.243588 L92.848752,73.94641 C92.817167,73.215437 93.361308,72.916861 94.061297,73.283435 L100.97191,76.900689 C101.67124,77.266271 102.23029,78.163021 102.21356,78.892395 L102.05386,86.104129 C102.03688,86.833149 101.4602,87.118281 100.771,86.737686 L94.485983,83.265339 C94.141114,83.074158 93.820723,82.751354 93.582501,82.38503 z M91.36911,16.709103 L83.027861,11.377728 L83.780329,14.795884 L63.271393,19.310696 L64.77633,26.147008 L85.285267,21.632196 L86.037735,25.050353 z M63.159544,51.366148 L68.646617,59.605811 L69.334764,56.174127 L89.924866,60.303012 L91.301161,53.439645 L70.711059,49.31076 L71.399207,45.879076 z";
string runtime = "M30.373745,48.782903 L34.061225,52.334534 31.195886,55.092382 34.153223,58.390248 30.240102,69.677123 26.208671,58.520078 29.50873,55.051745 26.683462,52.334534 z M45.929993,48.400234 C54.993983,50.039733 61.855001,57.69262 61.855001,66.890767 L61.855001,74.228456 0,74.228456 0,66.890767 C0,57.772108 6.741145,50.166745 15.688139,48.441349 L30.12067,70.215768 z M25.578545,16.688857 C23.65094,16.684204 21.220639,17.161782 20.935762,19.541124 20.935762,19.541124 20.935762,24.164315 19.653679,24.781329 L19.335459,29.096056 18.053283,27.863076 18.53289,33.719246 20.935762,33.874751 C20.935762,33.874751 21.576943,45.740047 33.266517,43.429592 33.266517,43.429592 38.870365,41.733872 40.150172,33.874751 L42.073525,33.719246 42.553134,28.47904 41.752938,28.634368 C41.752938,28.634368 41.270957,24.164315 40.791351,22.315548 L40.470759,17.846459 C40.470759,17.846459 37.749578,15.688086 33.746217,17.537994 33.746217,17.537994 29.101681,17.382664 27.980984,16.920977 27.980984,16.920977 26.897432,16.692041 25.578545,16.688857 z M31.058608,7.9694567 C36.517556,7.9690171 40.31132,10.755741 40.31132,10.755741 47.356468,16.150166 43.51454,25.397617 43.51454,25.397617 45.114914,26.321945 44.955899,27.092082 44.955899,27.092082 44.955899,37.110899 42.073269,36.339536 42.073269,36.339536 40.470519,42.812609 34.228024,45.740028 34.228024,45.740028 22.056509,48.668684 19.014952,36.493806 19.014952,36.493806 16.452816,36.185347 16.132321,30.483463 16.132321,30.483463 15.32967,26.630488 17.573592,25.089074&#xd;&#xa;17.573591,25.089074 12.767717,14.301431 21.415519,11.065428 21.415519,11.065429 24.882823,8.7346496 28.19916,7.9696873 31.058608,7.9694567 z M102.65546,2.2428111E-07 L132.62833,2.2428111E-07 C132.79703,0.015760289 132.88041,0.074689228 132.88041,0.17815748 L132.88041,2.1694074 C132.88041,2.2879505 132.79703,2.3468795 132.62833,2.3468795 L121.34853,2.3468795 121.34853,2.5236663 C122.95419,3.129401 124.20085,4.3682791 125.08754,6.2423564 L125.21407,6.8844078 132.62833,6.8844078 C132.79703,6.8987974 132.88041,6.9577264 132.88041,7.0611946 L132.88041,9.0524446 C132.88041,9.1716729 132.79703,9.2299166 132.62833,9.2299166 L125.49852,9.2299166 C125.49852,11.458253 123.54564,13.62766 119.63793,15.737453 116.17356,17.125024 113.71358,17.818467 112.25506,17.818467 112.25506,17.877396 112.17169,17.90686 112.00298,17.90686 L128.09679,32.470531 128.09679,32.648003 121.98314,32.648003 C121.91939,32.648003 115.69785,27.011381 103.32146,15.737453 L103.32146,15.64906 105.25374,15.64906 C112.09714,15.64906 116.20495,13.930527 117.57814,10.492092 117.66249,10.078904 117.70467,9.7472579 117.70467,9.4957821 L117.70467,9.2299166 102.65546,9.2299166 C102.48676,9.2299166 102.4024,9.1716729 102.4024,9.0524446 L102.4024,7.0611946 C102.423,6.9433367 102.50735,6.8844078 102.65546,6.8844078 L117.57814,6.8844078 C117.07202,5.5420614 115.99406,4.4491351 114.34721,3.6083699 112.06477,2.7669195 109.98537,2.3468795 108.10507,2.3468795 L102.65546,2.3468795 C102.48676,2.3468795 102.4024,2.2879505 102.4024,2.1694074 L102.4024,0.17815748 C102.423,0.059614384 102.50735,2.2428111E-07 102.65546,2.2428111E-07 z M108.14659,48.929507 C108.60258,48.991774 109.04681,49.141183 109.36937,49.363049 L115.81339,53.795493 C116.45843,54.240077 116.38944,54.823783 115.65763,55.094693 L108.4344,57.770352 C107.70384,58.041421 106.60199,57.871593 105.98716,57.393159 L99.9046,52.666692 C99.290227,52.188297 99.390153,51.589703 100.12753,51.335543 L106.85324,49.018828 C107.22285,48.89212 107.6906,48.867242 108.14659,48.929507 z M116.1849,64.313321 C115.92341,64.653389 115.58309,64.94123 115.22663,65.094721 L108.10545,68.161015 C107.39176,68.467501 106.06313,68.211203 106.12515,67.483853 L107.53189,60.218189 C107.59321,59.49177 108.24373,58.679514 108.97672,58.414146 L116.22178,55.785567 C116.95453,55.520553 117.48765,55.894865 117.40702,56.618542 L116.6701,63.218556 C116.62902,63.580956 116.44638,63.973252 116.1849,64.313321 z M97.413327,62.406376 C97.237591,62.012556 97.150618,61.587373 97.195072,61.225596 L98.083245,53.998148 C98.173009,53.274272 98.762534,53.056366 99.39653,53.514899 L105.65592,58.04004 C106.28943,58.497505 106.6957,59.45819 106.55825,60.173748 L105.20487,67.249664 C105.06723,67.964837 104.44764,68.164968 103.82667,67.694143 L98.16417,63.398968 C97.853566,63.16265 97.589065,62.800195 97.413327,62.406376 z M126.78569,63.810287 C127.22452,63.945806 127.6348,64.164732 127.91072,64.434719 L133.42292,69.828487 C133.9745,70.369279 133.79304,70.929568 133.01683,71.075206 L125.35508,72.514344 C124.58007,72.660342 123.52346,72.31391 123.00831,71.74491 L117.91059,66.122327 C117.39589,65.553439 117.61083,64.983629 118.38929,64.855303 L125.48945,63.68631 C125.87951,63.62266 126.34687,63.67477 126.78569,63.810287 z M131.7497,80.188338 C131.42516,80.478586 131.03278,80.704803 130.65053,80.796827 L123.01388,82.63516 C122.2487,82.818596 120.98461,82.350418 121.18705,81.648332 L123.98772,74.763734 C124.18929,74.062445 124.99014,73.373429 125.76644,73.233412 L133.44065,71.843943 C134.21664,71.704233 134.6712,72.157918 134.45107,72.853365 L132.44189,79.19566 C132.33096,79.543809 132.07424,79.898088 131.7497,80.188338 z M113.5575,75.252196 C113.46013,74.837836 113.45662,74.407275 113.57076,74.060288 L115.85124,67.128333 C116.08044,66.434185 116.70566,66.317188 117.24363,66.869834 L122.55527,72.324188 C123.09296,72.875708 123.30831,73.882835 123.03357,74.561043 L120.32248,81.268562 C120.04762,81.94636 119.39611,82.041039 118.87342,81.478486 L114.10739,76.346899 C113.8461,76.064715 113.65487,75.666556 113.5575,75.252196 z M101.91388,67.510834 C102.37301,67.50897 102.83501,67.595236 103.18925,67.770401 L110.26623,71.269876 C110.97477,71.621065 111.00358,72.210021 110.32818,72.581068 L103.66197,76.245107 C102.98782,76.616139 101.87517,76.601422 101.19075,76.21242 L94.420833,72.370663 C93.736869,71.981636 93.736043,71.373586 94.419702,71.018385 L100.6557,67.780056 C100.99849,67.602696 101.45476,67.5127 101.91388,67.510834 z M112.37454,81.656858 C112.17351,82.030879 111.88624,82.364073 111.56082,82.566176 L105.05978,86.603671 C104.4081,87.007498 103.05792,86.938622 102.99845,86.208073 L103.17924,78.800567 C103.11923,78.071041 103.62493,77.174063 104.30242,76.808351 L110.99791,73.18799 C111.67522,72.822663 112.26197,73.119732 112.30251,73.849232 L112.67071,80.50257 C112.69032,80.867986 112.57556,81.282833 112.37454,81.656858 z M93.582501,82.38503 C93.344281,82.018702 93.18823,81.608855 93.172043,81.243588 L92.848752,73.94641 C92.817167,73.215437 93.361308,72.916861 94.061297,73.283435 L100.97191,76.900689 C101.67124,77.266271 102.23029,78.163021 102.21356,78.892395 L102.05386,86.104129 C102.03688,86.833149 101.4602,87.118281 100.771,86.737686 L94.485983,83.265339 C94.141114,83.074158 93.820723,82.751354 93.582501,82.38503 z M91.36911,16.709103 L83.027861,11.377728 L83.780329,14.795884 L63.271393,19.310696 L64.77633,26.147008 L85.285267,21.632196 L86.037735,25.050353 z M63.159544,51.366148 L68.646617,59.605811 L69.334764,56.174127 L89.924866,60.303012 L91.301161,53.439645 L70.711059,49.31076 L71.399207,45.879076 z";

if (blend == database && database == runtime)
{
    MessageBox.Show("match found");
}

我收到一个消息框,说找到匹配。

1 个答案:

答案 0 :(得分:1)

ImageData中的哪种类型以及存储位置?我可以假设在这种情况下,对象ImageData必须是 Path 类型,然后才能引用它。在资源App.xaml<Window.Resources>等中,使用密钥添加路径:

<Path x:Key="MyPath" Data="M30.373745,48.782903 L34.061225 ..." />

Binding中,您必须指定Source并指定数据属性,如下所示:

<Path x:Name="MyPathButton"
      ...
      Fill="{StaticResource ButtonBackground}"                      // Your color
      Data="{Binding Source={StaticResource MyPath}, Path=Data}" /> // Your Path from resources

当通过Path这样的StaticResource表示字符串值时,这样:

<Window.Resources>
    <sys:String x:Key="MyPath">M30.373745,48.782903 ... </sys:String>
</Window.Resources>

<Path Name="MyPath"
      Data="{StaticResource MyPath}" />   

然后String不会转换为数据Path并发生异常。但是当通过Binding传递字符串时,内置的TypeConverter会自动将String转换为Path数据。